i made a shader that interprets the RGB color channels als OKLCH:
RGB channel | interpreted as
---|---
Red, 0 – 255 | Lightness, 0.0 – 1.0
Green, 0 – 255 | Chroma, 0.0 – 0.34
Blue, 0 – 255 | Hue, 0 – 360w
but the result looks less consistent than it shoud:
the strange thing is that the GDScript version of the converter is accurate despite using the exact same formulas in the exact same order:
if i ask the shader to translate oklch(0.7 0.1 248)
, i get this:
;
but if i ask the GDScript to do it, i get rgb(103.8397, 164.4775, 217.0177, 255)
, the same as this trusted OKLCH picker.
here are these 2 files in the project:
file | path
---|---
Shader | res://srgb_as_oklch.gdshader
GDScript | res://oklch_calculator.tscn::GDScript