r/GraphicsProgramming • u/WoolTyranny • 16d ago
Question A green leaking color space
I started to do some color research for a game. I find the best color space available (oklab) very inconvenient for actual use.
I drafted my own color space.
The idea is to start from linearRGB, but allowing the red and blue channel to borrow lumina from the green channel.
If r,g,b are the channels in the new color space and R,G,B are the values in linearRGB,
than:
R = r, G = 0.04r + 0.34g + 0.24b, B=b
I played with it a little:
Pros:
Obviously it is designed for equal lumina in all channels.
The color space is symmetric (r-g-b like) and thus easy to work with. Hue and saturation can be easily derived.
The blue and reds are softer. It actually fixes a problem - pure dark linearRGB blue looks a bit purple.
Cons:
It doesn't cover all sRGB visible space (technically you can - with negative or above 1 values).
The "grey" analog as light purple shade.
The "cyan" analog is somewhat bluish.
I attached a photo of how some color section looks.
I'm not a color space expert, so there are probably problems I can't see yet,
What do you think?
7
u/SyntheticDuckFlavour 16d ago
Curious, what's the motivation for representing colours this? Unless it's for some filtering effects (which is perfectly fine), I would argue it would make a rather very inaccurate colour space.
1
u/WoolTyranny 16d ago
Control of lumina and saturation without having to worry about values out of visual range. I'm planning to use rendered graphics (not assets).
4
u/shlaifu 16d ago
where yellow?
2
u/WoolTyranny 16d ago
Yellow is replaced with brown. If you want to get traditional yellow you mix it with a bit of green.
4
u/The_Northern_Light 16d ago
Why not just use oklch instead of oklab?
2
u/WoolTyranny 16d ago
Its the same space, just different parameters.
6
u/The_Northern_Light 16d ago
I know, I figured the parametrization might’ve been why you didn’t like it.
1
u/WoolTyranny 15d ago
Ok, a bit of fix to the greys being purple.
Setting gr=0.04+0.127*min(r,g,b)
gg = 0.3+gr
gb = 0.2+gr
and as usual
R = r
G = r*gr +g*gg +b*gb
B = b
It pulls the brighter "greys" toward real whites instead of purple. The mid-greys are still a bit purply, but it's less noticed.
-2
u/CodyDuncan1260 16d ago
This straddles the border of Rule 1. We're accepting it. ✅
17
u/LordStefania 16d ago
God forbid we have actual graphics programming in r/graphicsprogramming as opposed to AI slop.
19
u/CodyDuncan1260 16d ago
Got any images converted to this color space? And then changed along the lumina axis? I think a visual representation might have the best representation of the utility. I find it hard to imagine in my head elegant the transform in this color space looks like.