Page MenuHome

Compositor: New Posterize Node
ClosedPublic

Authored by Aaron Carlisle (Blendify) on Aug 23 2021, 8:21 PM.
Subscribers
None
Tokens
"Love" token, awarded by Raimund58."Love" token, awarded by dshot92."Love" token, awarded by gilberto_rodrigues."Love" token, awarded by Draise."Love" token, awarded by iyadahmed2001.

Details

Summary

The posterize node limits the number of colors per channel.
This is useful to generate masks or to generate stylized images

Both the tiled and full-frame implementation are included in this patch

Diff Detail

Repository
rB Blender
Branch
compositor-posterize (branched from master)
Build Status
Buildable 16577
Build 16577: arc lint + arc unit

Event Timeline

Aaron Carlisle (Blendify) requested review of this revision.Aug 23 2021, 8:21 PM
Aaron Carlisle (Blendify) created this revision.
  • Optimize: Use short instead of int
  • Cleanup: Make format
  • Cleanup: Unused code

If steps mean levels or percents, it may be more intuitive to posterize as steps increase just plugging the node it's full posterize. If it's by number of colors it's fine then.
If possible make it more progressive for fine control.

If an artist want to give feedback, it's very welcomed. I wonder if it could be useful to make the steps a socket to posterize with masks.

source/blender/compositor/operations/COM_ColorPosterizeOperation.cc
55

Better use BuffersIterator to do the whole loop inheriting from MultiThreadedOperation. See InvertOperation as an example. I started using MultiThreadedRowOperation on some operations, but later we decided to better use iterators.

Manuel Castilla (manzanilla) requested changes to this revision.Aug 23 2021, 11:51 PM
This revision now requires changes to proceed.Aug 23 2021, 11:51 PM
  • Review: Use BuffersIterator
  • Increase default step to 8 (up from 2)

The code looks good to me, but wait for Jeroen to have a look too.
My opinion is an artist should decide if a new node functionality is useful enough to be a main node.

source/blender/compositor/nodes/COM_ColorPosterizeNode.cc
21

Rename files to match UI name and class names? ColorPosterize -> Posterize

Based on other compositing pipelines and image editors this is a standard operation so I don't see any reason not to include it. It's also nice that non technical users don't have to use math nodes. I still want to investigate making the step size a float to see if that might be more artist friendly.

release/scripts/startup/nodeitems_builtins.py
372

This might better belong in the color menu

LGTM. I can see it be useful for mask extractions, but in that specific case a math operation would be useful.

This revision is now accepted and ready to land.Aug 25 2021, 2:47 PM

So based on some experiments, I found using a float input to be much more customizable, I will update this catch where the steps is exposed as a float input.

  • Move node to color menu
  • Convert steps to float & rename files to match node name
  • Convert node property to socket
Aaron Carlisle (Blendify) requested review of this revision.Aug 30 2021, 6:03 PM

I have made quite a few changes to both the node and UX by changing the steps to a float and exposing it as a socket.

  • Merge branch 'master' into compositor-posterize

Yes, to me this is better for user, they can use masks and have more fine control.

  • Run make format before committing.
source/blender/compositor/nodes/COM_PosterizeNode.cc
16 ↗(On Diff #41231)

2021

source/blender/compositor/operations/COM_PosterizeOperation.h
47 ↗(On Diff #41231)

End comments with full stop.
Revise the other comments too.

This revision is now accepted and ready to land.Sep 4 2021, 9:37 PM
This revision was automatically updated to reflect the committed changes.