I began writing this before Troy’s latest replies and I also don’t know what is meant by “biasing the mixture” or “reconstruction RGB ratios” (but then I know quite little about color management).
It may well be that this post is going to be invalidated by what ever you are gonna explain about those things. But with that in mind, here it is:
Maybe it would help to break down the entire pipeline and see where potential issues lie.
Please, anybody, correct me if I’m wrong or I’m overslimplifying something / skipping a step. This is from memory and as far as I understand it right now:
First up, we have two broad issues for colors in the spectral branch.
-
Spectral Reconstructions of RGB input colors (the current implementation will eventually be replaced by that parametric Wenzel Jacob take on the issue)
(this is designed for reflectance)
-
How to interpret such reconstructed spectra in the context of light sources
Let’s put a pin in 1 as a known issue with a known eventual solution.
But 2 has a number of complications:
- sRGB uses D65
- (1 1 1) white should mean a light source displays as white
- but for reflectance, (1 1 1) white should mean a perfectly reflective material
- the way Cycles nodes for light sources work, colors are being applied twice
- multiplying a D65 spectrum by itself isn’t normally going to yield the same spectrum, so double-applying shifts the color away
The current solution to that is:
- render with Illuminant E (this deals with all the complications but the first)
- Colormanage the result into D65 (this fixes that part. But the look isn’t identical as primaries end up in slightly the wrong place.)
Is this the best approach? Are there other solutions?
What if we do treat emission and reflection differently?
Relying on the current spectral reconstruction idea, using simple constraints on three primaries, can this approach be adapted?
Perhaps we could have, for now, two different spectral reconstruction models using almost the same technique.
- Reflectance and Transmittance. Same as now (until the other technique can replace it)
- Three lights (linearly combinable)
- least slopes constraint
- sums to 1 (so “Illuminant E white” but this is not an illuminant)
- each of the lights corresponds to scene linear saturated red, green, and blue respectively
- must not be less than 0 anywhere
- must not be more than 1 anywhere
- Emission - here we don’t have anything yet.
- Three lights (linearly combinable)
- least slopes constraint
- sums to D65 (or whichever white point is correct)
- each of the lights to scene linear saturated red, green, and blue respectively
- must not be less than 0
- total energy needs to be such that the chosen white point would come out to exactly (1 1 1 ) white for that color space (but individual wavelengths may go beyond 1)
@Scott_Burns do you think a setup like that would be reasonable? Even as I don’t expect that to be final (I really don’t know what best to do with light spectra though), if there isn’t any very obvious flaw with this, it’d seem worth a shot to me.
Then just pick the appropriate sort of spectral reconstruction: Emission shaders (and wherever else emission occurs) get the emission variant whereas all other shaders get the reflectance/transmittance concept.
Additionally, for lamps only, the behavior actually would have to change depending on whether nodes are off (the color then needs to be treated like an emission spectrum) or on (in this case it actually has to be treated more like the reflectance spectrum because otherwise we get a double applied D65)
– this may mean, that the results are not identical if you don’t just use any neutral grey value light for the outside-the-node-network color. But for any grey it should match.
It may also make sense to consider an alternative for scattering spectra. I’m not sure what the right thing for those would be.
One drawback of this particular spectral reconstruction approach is, that we’d have to do it once per color space.
Another is, that it basically breaks for larger color spaces. So by no means is this a final solution.
However, at least the separation of Reflection and Emission (and possibly Scattering), independent of what actual spectral reconstruction approach we pick for each, ought to still work like that, right?