<p>First off let me say that the first line in 5.2.2 is wrong or misleading when it says &quot;spectral response curves, one for each of red, green, and blue, as emitted by the display&quot;. A &quot;spectral response curve&quot; is the property of a sensor, such as the human eye or a camera sensor, which responds to light. For an emitter of light such as a display, the equivalent is an &quot;emission curve&quot; or more commonly &quot;spectral power distribution (SPD)&quot;.</p>
<p>The XYZ values are the device independent specification of a colour, and can be calculated using the specific spectral response curves called colour matching functions (CMFs). The XYZ system is defined that any real colour will have X, Y and Z values in the range of 0 to 1, though not all combinations of values in that range are physically possible colours.</p>
<p>The CMFs are available from the Colour and Vision Research laboratory here <a href="http://www.cvrl.org/" rel="nofollow noreferrer">http://www.cvrl.org/</a>, under the &quot;CMFs&quot; link. They look like this, with the X CMF displayed in red, Y displayed in green and Z displayed in blue.</p>
<p><a href="https://i.sstatic.net/pSAic.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pSAic.png" alt="tristimuls CMFs plotted" /></a></p>
<p>You can combine any SPD with these CMFs to get the XYZ values of that SPD, that is what the function is doing. By multiplyng the amount of each wavelength emitted by one of the RGB emitters in the display with the response strength of the CMF and summing them together, you calculate the total response to that emitter. By doing this for each of the X, Y and Z CMFs you get the XYZ value of the colour of that emitter.</p>
<p>For sRGB monitors these should be approximately (in XYZ order):<br />
R: (0.4124564 0.2126729 0.0193339)<br />
G: (0.3575761 0.7151522 0.1191920)<br />
B: (0.1804375 0.0721750 0.9503041)</p>
<p>If you look at the values in the RGBToXYZ function you will see these approximate values in the matrix, but arranged vertically rather than horizontally.</p>
<p>Many different SPDs could give these same XYZ values, but any SPD with the same XYZ values should look the same to the human eye, so it does not matter that different monitors have different SPDs, as long as they have the same XYZ values.</p>
<p>Once you have these values for the monitor, you can convert any colour's XYZ values to the required RGB values using the XYZToRGB function. If all three values are in the range 0 to 1, you can display the colour on the monitor. If any value is outside of the range of 0 to 1, then the colour is outside of the gamut of the monitor, and cannot be displayed accurately on that monitor.</p>
<p>The reason for doing this is to convert an SPD to three values in RGB or XYZ, which is much easier to manage than the full detail of the SPD, and in most cases is an adequate description of the SPD. You can just sum the XYZ values for each SPD multiplied by the linear RGB value for each to get the resulting total XYZ, which is much simpler than calculating the combined SPD and then calculating the XYZ of the combined SPD, but will give the same answer.</p>
<p>One last note, throughout the article you refer to and this answer, RGB values are given as LINEAR RGB values. In practice RGB values are usually given as GAMMA-ENCODED RGB values for efficiency, so there is an additional step you would need to do in practice to convert the values.</p>

CC BY-SA 4.0
2022-10-03T13:05:02.763Z
2022-10-03T18:22:36.800Z
2022-10-03T18:22:36.800Z
Timothy Maguire
<p>I'll try my best to give an overview of the subject, and english is not my first language so feel free to ask more detailed information in comments etc.</p>
<hr />
<p>Here are some terms, light is an electro magnetic radiation. When the power of this radiation falls between a certain wave length, it becomes visible for human beings. <code>S</code> is the function that takes wave length value as input and gives a power value as output and is called a s(pectral) p(ower) d(istribution).</p>
<p>Color on the other hand means different things to different people. We can define color based on our perception of it, or based on the measured spectral power distribution, based on the average physical capacity of human eye etc.</p>
<p>The thing is spectral distributions change over time constantly, but the color does not change at the same speed. This means that variations in the spectral distribution does not map to color one to one, which shows that there must be a transformation happening between what we perceive as color and what we measure as spectral distribution.</p>
<p>Now the needs for an accurate and standardised representation of color was quite important for daily life (think of colors around road signs, lamps, etc), the CIE defined its trichomatic system for this purpose. The main idea behind the trichromatic system was that given a carefully chosen three reference spectral distribution, we can represent all of the perceivable colors by mixing these three spds.</p>
<p>Notice that I did two things over there. I passed from mixing spds, which should produce an spd at the end, to color values which are generally represented with trichromatic system, and I added perceived. The last one is to signal that this is an experimental procedure, that is people did a lot of experiments to come up to this idea of mixing reference spds.</p>
<p>How do we arrive from mixing spds which should produce an spd to a color value in rgb ? Simple by summing all the power values of the spd resulting from the mix.
The mix is <span class="math-container">$R(\lambda)S(\lambda)$</span> part where <code>R</code> is the reference spd and <code>S</code> is any given spd. <span class="math-container">$\int$</span> indicates that we are summing the resulting multiplication.
<span class="math-container">$\lambda$</span> is the wave length.</p>
<p>A great reference on the subject is McCluney 1994, Introduction to Radiometry, chapter 11. Read through 11.2 and then 11.4, that should clarify anything and everything with respect to spds and their transformation to trichromatic values</p>

CC BY-SA 4.0
2021-01-08T05:24:47.430Z
"spectral distributions change over time constantly, but the color does not change at the same speed." Not sure where this is coming from, but it doesn't have anything to do with change over time - it's just that our eyes have just 3 types of cones and so the infinite-dimensional physical spectra get projected down to a 3-dimensional color space.
Nathan Reed
CC BY-SA 4.0
2021-01-08T07:58:57.573Z
"spd change over time..." that was my, not so accurate way of describing metamerism of the eye, that is it perceives identical color with different spectral distributions. As for 3 cones, McCluney says on page 345-346 that spectral responses of the three cones largely overlap so it was not use full for a color specification. I really like your blog by the way.
Kaan E.
CC BY-SA 4.0
2021-01-07T04:54:02.530Z
2021-01-07T04:54:02.530Z
Kaan E.
<p>I am reading Physically Based Rendering <a href="http://www.pbr-book.org/3ed-2018/Color_and_Radiometry/The_SampledSpectrum_Class.html#RGBColor" rel="nofollow noreferrer">section 2.2.2 on RGB color</a>.</p>
<p>I am trying to understand how, given a display spectral response curves for rgb intensities, we can choose the intensities so that the display will emit an equivalent spectrum (a CIE xyz metamer)</p>
<p>It is my understanding that the following section tries to explain exactly that.</p>
<blockquote>
<p>Given an <em>(x,y,z)</em> representation of an SPD, we can convert it to corresponding
RGB coefficients, given the choice of a particular set of SPDs that
define red, green, and blue for a display of interest. Given the
spectral response curves <em>R(lambda)</em>, <em>G(lambda)</em>, and <em>B(lambda)</em>, for a particular display, RGB
coefficients can be computed by integrating the response curves with
the SPD <em>S(lambda)</em> and using the tristimulus theory of color perception:</p>
</blockquote>
<p><span class="math-container">$$r = \int R(\lambda) S(\lambda) d\lambda$$</span></p>
<p>I can't understand this formula. Why it is considered correct? Why choosing <em>r</em> this way makes the display emit the correct / equivalent SPD?</p>
<p>Can someone break it down for me?</p>

<color><physically-based><color-science><spectral>
How to determine RGB values given a display spectral response curve?
Elad Maimoni
# How to determine RGB values given a display spectral response curve?

(Asked by: username_0 on 2021-01-03)

I am reading Physically Based Rendering [section 2.2.2 on RGB color](http://www.pbr-book.org/3ed-2018/Color_and_Radiometry/The_SampledSpectrum_Class.html#RGBColor).

I am trying to understand how, given a display spectral response curves for rgb intensities, we can choose the intensities so that the display will emit an equivalent spectrum (a CIE xyz metamer)

It is my understanding that the following section tries to explain exactly that.

> Given an *(x,y,z)* representation of an SPD, we can convert it to corresponding
> RGB coefficients, given the choice of a particular set of SPDs that
> define red, green, and blue for a display of interest. Given the
> spectral response curves *R(lambda)*, *G(lambda)*, and *B(lambda)*, for a particular display, RGB
> coefficients can be computed by integrating the response curves with
> the SPD *S(lambda)* and using the tristimulus theory of color perception:

$$r = \int R(\lambda) S(\lambda) d\lambda$$

I can't understand this formula. Why it is considered correct? Why choosing *r* this way makes the display emit the correct / equivalent SPD?

Can someone break it down for me?

**Tags:** color, physically-based, color-science, spectral


---

## 2 answers

### Answer by username_1 on 2022-10-03. Score: 1

First off let me say that the first line in 5.2.2 is wrong or misleading when it says "spectral response curves, one for each of red, green, and blue, as emitted by the display". A "spectral response curve" is the property of a sensor, such as the human eye or a camera sensor, which responds to light. For an emitter of light such as a display, the equivalent is an "emission curve" or more commonly "spectral power distribution (SPD)".

The XYZ values are the device independent specification of a colour, and can be calculated using the specific spectral response curves called colour matching functions (CMFs). The XYZ system is defined that any real colour will have X, Y and Z values in the range of 0 to 1, though not all combinations of values in that range are physically possible colours.

The CMFs are available from the Colour and Vision Research laboratory here <http://www.cvrl.org/>, under the "CMFs" link. They look like this, with the X CMF displayed in red, Y displayed in green and Z displayed in blue.

[![tristimuls CMFs plotted](https://i.sstatic.net/pSAic.png)](https://i.sstatic.net/pSAic.png)

You can combine any SPD with these CMFs to get the XYZ values of that SPD, that is what the function is doing. By multiplyng the amount of each wavelength emitted by one of the RGB emitters in the display with the response strength of the CMF and summing them together, you calculate the total response to that emitter. By doing this for each of the X, Y and Z CMFs you get the XYZ value of the colour of that emitter.

For sRGB monitors these should be approximately (in XYZ order):  
R: (0.4124564 0.2126729 0.0193339)  
G: (0.3575761 0.7151522 0.1191920)  
B: (0.1804375 0.0721750 0.9503041)

If you look at the values in the RGBToXYZ function you will see these approximate values in the matrix, but arranged vertically rather than horizontally.

Many different SPDs could give these same XYZ values, but any SPD with the same XYZ values should look the same to the human eye, so it does not matter that different monitors have different SPDs, as long as they have the same XYZ values.

Once you have these values for the monitor, you can convert any colour's XYZ values to the required RGB values using the XYZToRGB function. If all three values are in the range 0 to 1, you can display the colour on the monitor. If any value is outside of the range of 0 to 1, then the colour is outside of the gamut of the monitor, and cannot be displayed accurately on that monitor.

The reason for doing this is to convert an SPD to three values in RGB or XYZ, which is much easier to manage than the full detail of the SPD, and in most cases is an adequate description of the SPD. You can just sum the XYZ values for each SPD multiplied by the linear RGB value for each to get the resulting total XYZ, which is much simpler than calculating the combined SPD and then calculating the XYZ of the combined SPD, but will give the same answer.

One last note, throughout the article you refer to and this answer, RGB values are given as LINEAR RGB values. In practice RGB values are usually given as GAMMA-ENCODED RGB values for efficiency, so there is an additional step you would need to do in practice to convert the values.


---

### Answer by username_2 on 2021-01-07. Score: 0

I'll try my best to give an overview of the subject, and english is not my first language so feel free to ask more detailed information in comments etc.

---

Here are some terms, light is an electro magnetic radiation. When the power of this radiation falls between a certain wave length, it becomes visible for human beings. `S` is the function that takes wave length value as input and gives a power value as output and is called a s(pectral) p(ower) d(istribution).

Color on the other hand means different things to different people. We can define color based on our perception of it, or based on the measured spectral power distribution, based on the average physical capacity of human eye etc.

The thing is spectral distributions change over time constantly, but the color does not change at the same speed. This means that variations in the spectral distribution does not map to color one to one, which shows that there must be a transformation happening between what we perceive as color and what we measure as spectral distribution.

Now the needs for an accurate and standardised representation of color was quite important for daily life (think of colors around road signs, lamps, etc), the CIE defined its trichomatic system for this purpose. The main idea behind the trichromatic system was that given a carefully chosen three reference spectral distribution, we can represent all of the perceivable colors by mixing these three spds.

Notice that I did two things over there. I passed from mixing spds, which should produce an spd at the end, to color values which are generally represented with trichromatic system, and I added perceived. The last one is to signal that this is an experimental procedure, that is people did a lot of experiments to come up to this idea of mixing reference spds.

How do we arrive from mixing spds which should produce an spd to a color value in rgb ? Simple by summing all the power values of the spd resulting from the mix.
The mix is $R(\lambda)S(\lambda)$ part where `R` is the reference spd and `S` is any given spd. $\int$ indicates that we are summing the resulting multiplication.
$\lambda$ is the wave length.

A great reference on the subject is McCluney 1994, Introduction to Radiometry, chapter 11. Read through 11.2 and then 11.4, that should clarify anything and everything with respect to spds and their transformation to trichromatic values

> **Comments:**
> **username_3**: "spectral distributions change over time constantly, but the color does not change at the same speed." Not sure where this is coming from, but it doesn't have anything to do with change over time - it's just that our eyes have just 3 types of cones and so the infinite-dimensional physical spectra get projected down to a 3-dimensional color space.  
> **username_2**: "spd change over time..." that was my, not so accurate way of describing metamerism of the eye, that is it perceives identical color with different spectral distributions. As for 3 cones, McCluney says on page 345-346 that spectral responses of the three cones largely overlap so it was not use full for a color specification. I really like your blog by the way.  

---

