A Houdini HDA that creates a ramp based on a color palette from an image.
Compatible with Houdini 18.0+
You do not need to download the repo for the tool to work.
This node can be used on its own to create ramps to use elsewhere, or to modify the color of the incoming geometry. It uses k-means clustering in Lab space to group visually-similar colors into a set number of clusters, resulting in a color palette from the input image.
If you are using a Houdini build < 18.0.460, and you are using an ACES workflow, be sure to tick on "Convert Image to ACEScg Colorspace". If you are using 18.0.460+, this step is done for you.
- 18.0.460+ includes the
hou.Color.ocio_activeDisplays()
method. If you're using build 460 or later, the ACEScg toggle will be automatically enabled for you if necessary according to your OCIO environment.
Color Palette Ramp can take an input, but does not require one. You can use the ramp all on its own if you want to channel reference it elsewhere from within Houdini.
You can control the number of swatches you want your ramp to have. 5 - 8 is usually plenty!
Choose to sort by Hue, Saturation, Value, or nothing at all.
Color Palette Ramp detects your environment's OCIO settings, and automatically enables sRGB -> ACEScg conversion.
Key out luminance areas that don't interest you to avoid having too many overly dark or bright swatches.
Under the hood, the color clusters are calculated using the K-Means algorithm. You can choose between a VEX implementation or the Houdini Cluster SOP. All calculations are done in Lab space using Delta E 76. In the future, this would hopefully be changed to Delta E 2000
You have control over how accurate the resulting palette is. The defaults are balanced between quality and speed, leaning a little more towards quality. You can drastically downsample the incoming image and still get pretty good results.
You can output the color swatches as a Detail Array attribute for use elsewhere.
All changes to the ramp update automatically, so you don't need to press anything extra. The ramp creation itself is not time-dependent, so inputting animated geometry should not incur much of a performance hit
- Help card and tooltips provided just like normal Houdini help.
- Embedded example (RMB > Examples)
Update Houdini 19.0: It appears SideFX has removed this feature, and it
was a little buggy in older versions. The extra colorpaletteramp_example
definition has been removed, and replaced with a button to spawn some examples
from the node directly.
This repo acts as a Houdini Package.
- Clone or copy this repo to
$HOUDINI_USER_PREFS/packages
(create thepackages
directory if it does not exist). - Move or copy
colorpaletteramp.json
into$HOUDINI_USER_PREFS/packages
- Launch Houdini