# How correct is rendering in XYZ / linear RGB space?

I have a spectral power distribution (SPD, 5 nm steps) for all light sources in the scene and SPDs for the reflectance of all surfaces under any light / viewer angle in question.

I'm going to calculate in floating point precision and not clamp any values. Except for pathological cases like monochromatic light or special things like dispersion effects, does it make a difference whether I render using the spectrum, XYZ color space or linear RGB color space? Note that I will convert the result to sRGB as a last step in any case.

Specifically, is it invariant at which point (before or after multiplication of surface BRDF with light intensity) I integrate to convert spectrum to XYZ? Does the introduction of reference white in XYZ / RGB distort the colors when working with light sources of a different color / SPD?

• Yes, it makes a difference. As an extreme example, suppose the incident light spectrum is a delta function at 600 nm and the reflectance of the surface is a delta function at 610 nm. Then the exitant light is zero, but if you convert both spectra to XYZ or RGB that's not what you will get.
– user106
Commented Nov 5, 2015 at 11:01
• @Rahul True. I changed the question to reflect that I'm less interested in these kind of contrived cases and more in the usual, real-world (somewhat) continuous spectra. Commented Nov 5, 2015 at 11:37
• I think this previous question covers a lot of similar ground: Are there common materials that aren't represented well by RGB? Most of the answers apply equally well to any three-component colour space, like XYZ.
– user106
Commented Nov 5, 2015 at 12:22
• I understand that there are "Effects for which the path of a ray is dependent on its wavelength", and I've explicitly excluded those. I also understand that there are "Colours that the human eye can detect that cannot be displayed in RGB". Since I will end up in sRGB anyway, I can't change that. The question holds: do the intermediate calculations yield the same results in common cases (no sodium lamps, no delta functions, just wide-range-of-frequencies stuff)? Commented Nov 5, 2015 at 12:43
• There will almost always be a difference in intermediate results when rendering using a three-component color space rather than the full spectrum. The pathological cases presented here just take that difference to an extreme. You say you don't care about sodium lamps, but you do care about wide-range-of-frequencies stuff - this makes this question very vague. Unless we know where your threshold is, we won't be able to answer this question. Commented Nov 5, 2015 at 13:08