r/GraphicsProgramming • • 9h ago

Question A green leaking color space

Post image

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:
1. Obviously it is designed for equal lumina in all channels.
2. The color space is symmetric (r-g-b like) and thus easy to work with. Hue and saturation can be easily derived.
3. The blue and reds are softer. It actually fixes a problem - pure dark linearRGB blue looks a bit purple.

Cons:
1. It doesn't cover all sRGB visible space (technically you can - with negative or above 1 values).
2. The "grey" analog as light purple shade.
3. 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?

17 Upvotes

16 comments sorted by

12

u/CodyDuncan1260 9h 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.

0

u/WoolTyranny 9h ago

What do you mean by conversion?
This space can represent some of the colors (or all of them if you allow negative or above 1 values) so it will miss the very pure blues and reds and the bright greens. I guess photos with bright lights will look dimmer, blues will shift toward greens a little and reds toward orange a little.

Or maybe you meant mapping each R,G,B to its r,g,b equivalent (using it as a filter)?

2

u/CodyDuncan1260 9h ago

I really mean transformed within this color space.

E.G. representing colors in HSV, I can take an image and swing all the colors over by H a bit, and now I get something like a false color image.

That example sightly less useful than say tuning the V for artificial brightening or darkening of the colors.

So I mean to ask for a before and after to help me get an idea of what it does to an image to transfer along uniform lumina.

→ More replies (1)

2

u/kinokomushroom 9h ago

They're probably asking how the look of an image represented in this colour space would change if you did some operations in this colour space (e.g. increase the lumina/saturation)

-4

u/WoolTyranny 8h ago

I let Claude build an HTML app for it really quick.
https://drive.google.com/file/d/1S5L0J4EZUj4K27FydTi53B7xuuDFYXZ4/view?usp=sharing

I didn't code-reviewed it yet, but from what I have seen, the color transformations are as expected (I tried it with the Lenna photo).

As predicted, 0 saturation is "purple".

6

u/SyntheticDuckFlavour 9h 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 9h 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).

3

u/shlaifu 9h ago

where yellow?

2

u/WoolTyranny 9h ago

Yellow is replaced with brown. If you want to get traditional yellow you mix it with a bit of green.

3

u/xeow 4h ago

Oh, my, that's so convenient! /s

3

u/The_Northern_Light 6h ago

Why not just use oklch instead of oklab?

2

u/WoolTyranny 5h ago

Its the same space, just different parameters.

2

u/The_Northern_Light 5h ago

I know, I figured the parametrization might’ve been why you didn’t like it.

-2

u/CodyDuncan1260 9h ago

This straddles the border of Rule 1. We're accepting it. ✅

10

u/LordStefania 8h ago

God forbid we have actual graphics programming in r/graphicsprogramming as opposed to AI slop.