# light spectrum reflection / absorbation?

I would like to know how material works with respect to light.

first of all, I've a lightsource e.g. the sun. The sun has a spectrum like figure1

Figure1

When an object is illuminated by the sun, how does the reflected spectrum change? Does each surface has an own reflection spectrum? where each photon "checks" its wavelength and "decides" to reflect or absorb?

for example a green object would absorb all wavelength except a small bandwidth of green?

Lets do a small example: Lets imagine having a ray tracer setup with the sun as illumination, a few objects with different colors and a physical simulated camera with 3 color channels, where each color channel has a very small bandwidth of 10nm (see Figure2).

Figure2

Then we can say, that we change the sun spectrum so that only the 10nm bandwidth of the camera channels are stored into 3 watt values. The same with each material reflection spectrum.

Each simulated ray holds the three values of the sun spectrum. In case the ray is intersecting an object, can I scale the three values by the objects material reflection spectrum with respect to the 3 camera wavelength and bandwidth?

Or did I understand it completely wrong?

When an object is illuminated by the sun, how does the reflected spectrum change? Does each surface has an own reflection spectrum? where each photon "checks" its wavelength and "decides" to reflect or absorb?

Yes, this is more or less correct. But when dealing with very many photons, striking very many different atoms/molecules mixed together into one material, we observe that some fraction, or percentage if you like, of the photons are reflected. So, the spectrum is made up not of yes-or-no, but that fraction, for each wavelength. This is called the surface's reflectance spectrum. You may also hear “diffuse reflectance” or “albedo”.

(“Diffuse” means the reflection happens at a random angle, usually due to roughness or translucency of the material; its opposite is “specular”, mirror-like reflection. When an object gleams and sparkles, that is specular reflection. Most objects exhibit some of both, and the specular reflectance can have a different color/spectrum than the diffuse — usually whiter.)

Then, as you have thought, we usually consider this only in 3 different wavelengths/bands since that is sufficient to reproduce most, but not all effects that human vision can observe. For an example of phenomena that require more than 3 bands, see color rendering index, a measurement of how well the spectrum of a light source, after interacting with the reflectance spectrum of illuminated objects, simulates broad-spectrum illumination such as sunlight. You cannot simulate this without simulating more components of the spectrum than just RGB. For more examples, see this other question: Are there common materials that aren't represented well by RGB?

Lets imagine having a ray tracer setup with the sun as illumination, a few objects with different colors and a physical simulated camera with 3 color channels, where each color channel has a very small bandwidth of 10nm (see Figure2).

Computing using the RGB approximation does not generally think about wavelength bands at all — we just pick 3 precise wavelengths for our R, G, and B primaries and express all other colors in terms of mixes of those primaries, which are identical as seen by the (typical) human eye to more complex spectra.

Any such choice of primaries will constrain the gamut of colors that can be represented — some highly saturated colors will be excluded, unless the color components are allowed to go negative to express the most extreme monochromatic (or purple) colors. This is usually an acceptable limitation, because RGB monitors are physically limited to emit only specific wavelengths based on the color of their LED emitters, LCD color filters, or CRT phosphors.

(Note that in printed graphics, the situation is more complex because instead of a display device emitting only R+G+B light, we produce an object with its own reflectance spectrum based on the pigments/dyes used. That's why 4-component “CMYK” color is used — it's a better match for the actual behavior of the pigments. In some cases, “spot colors” may be used, identifying a specific pigment to be laid down in a certain area, to produce precise colors or special effects such as shininess.)

In case the ray is intersecting an object, can I scale the three values by the objects material reflection spectrum with respect to the 3 camera wavelength and bandwidth?

Yes, you should multiply each wavelength/color-component of the incoming light by the object's reflectance for that color. The bandwidth need not be explicitly modeled — if changing the bandwidth makes any difference, then it is equivalent to changing the choice of primaries, i.e. working in a different color space. You can always convert a color from one RGB color space to another (when it is in the gamut of both) with a little bit of arithmetic.

Again, all of what I've said above is true when you are working in RGB. This does have limitations; if you want to precisely simulate the effects of monochromatic lights or color filters, you will need to use more color channels than just RGB. The more channels you use, the better your discrete approximation of the continuous spectra in real physics. However, this is rarely done in rendering — most computer graphics you have ever seen in your life were probably only calculated using RGB.

• thanks a lot! This answer is very detailed, which I very mush like :). I am trying to simulate different physical sensors, e.g. infra red camera as well. So my next step is to store whole material spectra (diffuse and specular) of all wavelength of all materials used in the scenario. After camera settings are read from config file, I'll decode the material spectrum into camera spectrum bands, so that the material will be rendered nearly correct. +1! Nov 11, 2022 at 15:04
• @Thomas Then you may be interested in the field of multispectral imaging — but I'm not aware of any particular useful links on simulating (rendering) colors beyond RGB. In principle it's just "use color-vectors that have more than 3 components of RGB", but I'm sure there are additional considerations that arise. Nov 11, 2022 at 15:24