<p>The usual way of doing this is to work in a color space that has luminance as one of the color components. For example the <a href="https://en.wikipedia.org/wiki/YCbCr" rel="nofollow">Y'CbCr color space</a> has a luminance channel (you can think of this as similar to brightness which is a poorly defined term) and 2 chrominance or color channels. There are other color spaces that separate colors in this way, too, such as HSV, HLS, La<em>b</em>, etc.</p>

<p>There are conversions to go between RGB and these various color spaces. The article linked above shows some of the conversions for going between Y'CbCr and sRGB, for example.</p>

<p>You don't say what type of graphics library you'll be using, so it's hard to give any more detail than what I've given you here. But I've done this in OpenGL, Core Graphics, and others. It shouldn't be too difficult.</p>

<p>Edited to add: I should point out that HSV defines value or "brightness" not as luminance but as the average of red, green, and blue, and as such does not track very will with our intuitive sense of brightness. HLS also suffers from some issues (discontinuities, bad but popular reference implementations) and is generally not recommended by the color scientists that I know.</p>

CC BY-SA 3.0
2016-09-28T03:24:27.023Z
Thank you, that was helpful. I will be checking out the conversions. I am using OpenGL.
Stackmm
CC BY-SA 3.0
2016-09-28T03:40:33.747Z
For OpenGL, converting to and from YCbCr should just be a matrix multiply of your color value, so just a single instruction in a glsl shader.
user1118321
CC BY-SA 3.0
2016-09-28T01:23:32.313Z
2016-09-28T02:49:00.587Z
2016-09-28T02:49:00.587Z
user1118321
<p>I am writing an application with multiple colored surfaces. I would like to preserve luminance, i.e. a blue surface would appear as bright as a green one, are there tools to help for this?</p>

CC BY-SA 3.0
2016-09-29T21:12:19.173Z
Can you give some more details? Are you rendering a 3d scene? What is happening right now to cause your luminance not to be preserved?  Are you just trying to render without lighting? It might also be useful info to know what you are using to render: OpenGL, DirectX, other?
Alan Wolfe
CC BY-SA 3.0
2016-10-01T01:26:21.590Z
Rendering a 3D scene with OpenGL, ambient lighting only. I wanted blue to be as perceptually bright (if that's the correct term) as green.
Stackmm
CC BY-SA 3.0
2016-10-01T01:29:10.133Z
I likely need to apply a conversion as the answer below suggests.
Stackmm
<color>
Preserving luminance
Stackmm
# Preserving luminance

(Asked by: username_0 on 2016-09-27)

I am writing an application with multiple colored surfaces. I would like to preserve luminance, i.e. a blue surface would appear as bright as a green one, are there tools to help for this?

**Tags:** color

> **Comments:**
> **username_1**: Can you give some more details? Are you rendering a 3d scene? What is happening right now to cause your luminance not to be preserved?  Are you just trying to render without lighting? It might also be useful info to know what you are using to render: OpenGL, DirectX, other?  
> **username_0**: Rendering a 3D scene with OpenGL, ambient lighting only. I wanted blue to be as perceptually bright (if that's the correct term) as green.  
> **username_0**: I likely need to apply a conversion as the answer below suggests.  

---

## 1 answers

### Answer by username_2 on 2016-09-28. Score: 2

The usual way of doing this is to work in a color space that has luminance as one of the color components. For example the [Y'CbCr color space](https://en.wikipedia.org/wiki/YCbCr) has a luminance channel (you can think of this as similar to brightness which is a poorly defined term) and 2 chrominance or color channels. There are other color spaces that separate colors in this way, too, such as HSV, HLS, La*b*, etc.

There are conversions to go between RGB and these various color spaces. The article linked above shows some of the conversions for going between Y'CbCr and sRGB, for example.

You don't say what type of graphics library you'll be using, so it's hard to give any more detail than what I've given you here. But I've done this in OpenGL, Core Graphics, and others. It shouldn't be too difficult.

Edited to add: I should point out that HSV defines value or "brightness" not as luminance but as the average of red, green, and blue, and as such does not track very will with our intuitive sense of brightness. HLS also suffers from some issues (discontinuities, bad but popular reference implementations) and is generally not recommended by the color scientists that I know.

> **Comments:**
> **username_0**: Thank you, that was helpful. I will be checking out the conversions. I am using OpenGL.  
> **username_2**: For OpenGL, converting to and from YCbCr should just be a matrix multiply of your color value, so just a single instruction in a glsl shader.  

---

