Oklab Color Space Interpolation In Unreal Engine
I made an HLSL version of Oklab color space interpolation to used in UE material nodes. I pack the code in a Material Function for convenient usage.
You can donwload either a UE4.27 version or a UE5 version for free.
What is Oklab color space
https://bottosson.github.io/posts/oklab/
Oklab can create smooth and uniform looking transitions between colors.
As shown in the first cover image, in normal RGB space, interpolation from blue to orange will cause pinkish transition. But in Oklab space, there is no pinkish color, it's much more natural and smoother.
How to use?
Put the three assets files in unreal project's Content folder. The file path should be like:
Content / OKLabColorSpace / MF_OkLabMix.uasset
Content / OKLabColorSpace / M_OKLab.uasset
Content / OKLabColorSpace / L_Demo.umap
The MF_OKLabMix is the material function file. The other two are just for demonstration.
Use this material function just like a normal lerp node.
Reference
The HLSL codes is converted from GLSL code which made on shadertoy by iq. The GLSL code is from shadertoy by iq.