Thoughts on making Cycles into a spectral renderer

What is “pure green”?
If you’re talking spectrally, that’s gonna be some specific wavelength (though there is a range of wavelengths which may justly be called “green” in that we decided to call the percept of those wavelengths by that term.)

If you’re talking what sRGB somewhat arbitrarily calls (0 1 0) green, that just simply isn’t a notion of green that corresponds to any one wavelength. It’s necessarily a mixture of (spectral) colors. Quite far, in fact, from maximally saturated.

Like, this (the triangle) is sRGB:

All the colors a well-callibrated sRGB screen can display are inside that triangle. Outside it, we have colors that we can perceive but a computer screen can’t show us.
As you can see, none of the three points that define the primaries (red, green, blue) are touching the outside edge. They are maybe kinda sorta close to 450, 550, 650 nm as a very rough rule of thumb, but if you actually looked at those three wavelengths, they would be far more saturated than what a screen can do.
Green in particular is pretty far away from the limits of what we could see.
To generate it, you’ll have to have some amount of light towards the red and blue portions of the spectrum.
There is no unique way to do this. In fact, there are infinitely many ways. But none of them will allow you to exclusively use green wavelengths (in that you would unambiguously call them “green” and not at the very least perhaps yellow or cyan if you saw them on their own rather than mixed together)

And even if the three colors were spectral (there are color spaces that do this), you could still only generate any color within the triangle the three colors define. Because the full space has this weird horseshoe shape, no single triangle of possible colors would accomplish giving you the entire space. So long as you don’t directly generate all spectral colors, some colors are going to have to give.

So the bottom line is, spectral green may be “pure” and then, yeah, there’s not gonna be red light in it. sRGB green, however, just simply isn’t “pure” in that strict sense, by construction.

I mean yes. You can, indeed, lower the saturation to mitigate these effects. The closer to grey you get, the less of a problem it’ll be. (In fact you don’t need to go away very far at all to get at least pretty close. I think a saturation of 0.8 is not an exact match yet but if you don’t directly compared you won’t notice anything amiss, usually)
This is what it means for spectral rendering to matter most with saturated colors.
The more noticeable deep bounces are, the more this matters though. (Simply because colors get more saturated as you bounce deeper) - for instance, absorption is quite affected by this.

Once again depends on what you mean by green light as well as red objects. sRGB green? Your average red object (say, a tomato) is gonna look brownish
Oh I can even show you a good example:

In vertical farms, they usually use magenta lighting in order to save power. No use in blasting leaves with green light if it all just gets reflected away anyways. Go for the stuff that actually gets absorbed to contribute to photosynthesis! - Which is red and blue light (Perhaps some UV and some IR)
On the right sight in the image you can see that the leaves here appear mostly brown, except where some white light hits them to reveal that they are actually a pretty darn healthy, saturated green.

Alternative test: Try shining a red laser (so a pure, spectral color) on some green or blue object. The more saturated and the farther away from red, the better. Are you able to see the laser light on the surface of the object? Yes? Congrats, you have shown that the object’s color actually reflects that sort of light. It may well be far dimmer, but for most materials it’s still gonna be visible.

It’s only once you get to rather extreme engineered cases such as vantablack where you can actually have intense laserlight just be swallowed by the material entirely.
– That said, some pretty common real world materials have colors that are out of gamut for sRGB!
In fact, the classic MacBeth chart contains one of them. The turquoise/cyan on it is out of gamut. Too saturated to fit in sRGB (if you happen to light it with white light)

Click here to see the MacBeth chart under a variety of sRGB-based lighting conditions







If you check it out, not a single one of those swatches is black. Not even the cyan under red light (top right)

It’s also quite noticeable under some of these lighting conditions, how colors that look basically identical under white light can look very different under other light conditions. That’s called metamerism and the reason for that is the aforementioned infinite number of ways to generate any one color (given a lighting condition)

If you had a “pure green” object in that it only reflects green light of a very narrow spectrum, that object would indeed not reflect any red light, but it’d also be so saturated that sRGB couldn’t capture it.

And as said, high saturation colors that fall outside sRGB do exist. Which is one situation where spectral rendering becomes doubly important:
The only way to get sRGB to emulate colors of that saturation level is to use negative brightness.
Like for that cyan in the top right of the macbeth chart, you’d actually need, like, -0.03 for the red channel to make it work within sRGB. But that’s completely unphysical and Cycles gives extremely strange results if you try to do this. It’s not equipped to properly handle negative light.

With spectral rendering, you can avoid this. Just give it the actual spectrum. Every calculation will involve positive light, energy will be appropriately preserved, and, sure, the end result will be oversaturated if you blast it with white light, but the actual rendering process will not involve negative light causing things to break and go weird.

Edit: I actually did extensive comparisons to check the difference in RGB rendered and Spectral behavior:

Obviously there were still some mistakes here (hopefully a better spectral upsampling algorithm is going to fix this), but it gives a wide range of cases and really shows at roughly which levels spectral rendering still matters vs. RGB rendering. - In all of these renders, saturation varies linearly from left to right and from top to bottom.
I.e. the topmost Suzannes have saturation 1, then .75, .5 .25 and 0
The leftmost wall has saturation 1, then .8, .6, .4, .2, and 0,
and the light source on top goes linearly from fully saturated to not at all saturated. The only reason you can even see the walls and suzannes in the leftmost chamber at all is because that light source is already down to .8 satuartion on top. But the differences are pretty big especially for the top left suzannes and if the suzannes are green, those differences can remain for quite a long time.

8 Likes