Utility nodes for colour operations in Blender shaders.
Currently includes (More utilities to be included along the way):
- Exact and approximate sRGB/Linear conversions
- Combine/Separate HSV nodes including the appropriate colour transformation.
- Oklab conversions NEW!
- Lab space HSV node NEW!
The conversion nodes are not meant to convert colour spaces of image textures, as it is best to use the OCIO conversions available in the image texture node itself. Instead, these conversions are meant to be used with colours generated from nodes such as Combine HSV and Color Ramp (in HSV mode), as they lack the built-in sRGB conversion found in Blender's RGB inputs.
This pack includes exact sRGB conversions, as well as approximate conversions, in case performance is absolutely critical, though the exact implementations are also quite fast.
For convenience, I have also included Combine/Separate HSV groups that already include the appropriate conversion.
HSV is not well suited to linear light models, as it encodes a perceptual concept. Though HSV is fuzzy in definition, it works best when the resulting RGB values are passed through a transfer function that more closely matches our perception.
Despite not accurately modelling human perception, sRGB is being used here, as it is the de-facto accepted standard for HSV, and is also used in Blender's colour inputs, thus making colours consistent everywhere.
Here is a comparison:
Oklab conversions and utilities [NEW]
Colour Utils now includes support for Oklab, an exciting new perceptual colour space by Björn Ottosson (https://bottosson.github.io/posts/oklab/).
This allows for much more well behaved colour transformations. Operations in this colour space more closely match expectations based on our perception.
Colour blending doesn't result in unwanted intermediary hues, lightness/saturation changes don't skew hues, and desaturation preserves perceived lightness.
Here's a colour blending comparison between sRGB and Oklab:
There's a striking difference when performing a hue rotation on highly saturated colours:
Desaturation is also much more perceptually linear, and preserves perceived lightness:
- Size864 KB