Thoughts on making Cycles into a spectral renderer

I suspect some nice optimizations are gonna be possible with the updates from the Everything Nodes effort.
Like for instance, Min, Max, Soft Min, Soft Max, Multiply, and Add could all become multiple-unsorted-input nodes like the (Geometry) Join node.

2 Likes

Please dont forget to fix the bug in the spectrum node,to keep very small values like 1.96e-9.Right know after entering such small values it its only 0 stored.The xyz combine node IE can keep small values.However for calc the whole reflection spectrum with n and k, sometimes such small values are needed,like the k values of water.

1 Like

If you activate Spectral and render on the CPU, currently the SSS renders black.
(It works with GPU rendering or with Spectral rendering turned off)

@pembem22 it might be a good idea to either hide spectral nodes or, preferably, display a warning “enable spectral rendering” when that is disabled. As it stands, you get really weird results if it isn’t enabled (as is to be expected of course) which might be confusing to newcomers

1 Like

Quick test of @pembem22 's latest additions. This is by no means physically accurate, it’s just a ‘ramp’ spectrum passed through the spectrum math node in the new cosine mode. Once this is built and uploaded it should make thin film interference trivial.

5 Likes

Wow love it! this already looks like thing film interference. It just fails to be correctly directional. And I can already see people use such modified versions of that “just for fun”. NPR rendering with that kind of effect.
I particularly enjoy how the blue tiles in the reflection shift color between more greenish and more purple

(Though I wouldn’t say TFI is trivial with this. It’s still quite a complex node setup haha. It’ll be trivial once it’s implemented as a basic shader, which probably could be optimized more than the node setup)

1 Like

@smilebags why is everything so red when spectral rendering is on? This doesn’t look right to me
Off:


On:

@smilebags Also why is Subsurface Scattering completely black?

Color management.

Yeah probably color management issue, because this was not the case before Filmic came in. But why would Filmic cause this? I just hope this is an easy fix.

This happened after the upgrade to the OCIO v2.

So the redness of that light source is a bit weird but difficult to change. What’s happening is, that sRGB demands a 6500K light source to be the white point. But “pure white” only makes sense as “reflect 100% of light”, right?
So the corresponds to a spectrum that’s a constant 1 everywhere, which is the Illuminant E spectrum which, with a whitepoint at 6500K, looks pinkish reddish.

Try either deactivating the nodes on your lamp, or, instead of white, putting in a (spectral) blackbody emitter at 6500 as color for that emiter (it’s in the “Spectral” menu if you add nodes)

And the SSS thing is a bug I already reported. It works just fine if you go for GPU rendering but for some reason with CPU rendering it’s currently broken. Hopefully the next build will fix it

1 Like

This was handled in the original configuration, unless someone has bungled it.

ah yeah you’re right - previous build left, current build right, same lighting and everything. Must also be related to that OCIO v2 thing

You maybe have seen this spectral rendering tests.The biggest difference to RGB seems to be the saturation.

Well yeah. There already are several examples of that in the depths of this thread. Spectral rendering allows literally every color we can possibly see (though screens can’t actually display this and some compromise has to be found in the color management)
By contrast, three-light sampling (i.e. RGB rendering) can only handle rgb colors within the colors of the chosen rendering color space.

Effectively, in RGB rendering, deeper and deeper bounces always exponentially go towards which ever is the brightest color among your three primaries, and with sRGB as the baseline, those primaries are far less saturated than the stuff we could potentially perceive.

Similarly, in spectral rendering, which ever specific wavelength is the brightest for some surface’s reflective response, is the color towards which the appearance of that material will shift at deeper and deeper bounces. But the limit here is an actually spectral, “pure” color which is as saturated as it could possibly be. And it’s also an entire continuous spectrum (namely the spectrum of visible light) that could be the limit, rather than just three possibilities.

Nice comparison though

Yes,like the spectrum curves of different lightsources…LED…Fireflame…Moonlight…Neonlights.ect

actually the light source is just the starting point. It’s very important for the initial appearance, and it can have a huge impact throughout if it’s spectrally fairly narrow (like spectrally spiky LED light or even coherent laser light), but if it’s pretty wide and close to white (say, sun light), eventually it’s mostly just a surface’s reflective response that matters.
– I’m talking about pretty deep bounce light here though. The situation where you’re most likely to see a lot of difference.

And the curve I meant isn’t any specific spectrum, but rather the border of the famous horseshoe shaped space of all visible colors.
You know, this thing:

Specifically the border that runs from red over green and turquoise to blue. Not the straight line that goes from red to blue. (Because that line isn’t spectral. It’s the line where all the magentas sit)

If light bounces on a particular surface that, say, has the largest peak at like 517 nm, so long as that wavelength is present in your initial light source’s spectrum at all, eventually the color of this object at very deep bounces will go towards that 517nm turquoise.

You may have seen this effect in action. For instance, some paper tends to kinda go towards yellow on deep bounces, whereas, I think more rarely, other paper tends to go blue. If you open a book and carefully check the place where the two pages meet, perhaps you’ll see the color go saturated towards either yellow or blue near that area.

That said, the initial color of your light source does matter (beyond whether a wavelength is present at all) in that it affects just how long it takes until any given color becomes predominant. If your light is pretty low on that turquoise (it looks a little purplish, I guess?), it’ll take more bounces for the response at 517nm to overtake the others. And of course, deeper bounces are also much darker. So if it takes too long for any given wavelength to overtake the contribution of others (because the spectrum is very flat or the initial spectrum already contains relatively little of your surface’s peak), and light is pretty much extinguished by then, you’ll just see a deep near-black shadow well before you perceive those pure-colors in such deep bounces.

So yeah, lots of caveats like that. Either way, bottom line is, on deeper bounces, colors tend to become more and more saturated, but in RGB rendering, that is limited to the saturation of your regular sRGB red/green/blue (or whichever color channel you’re using) and that limits maximum saturation well below what our eyes can perceive.

Oh Geometry Nodes now have errors!
I hope that can also be incorporated into shader nodes. For spectral nodes I’d like the following errors:

  • Any node that produces a spectrum should throw an error if you don’t have Spectral Rendering enabled
  • Any node that expects a single value, vector, or color input (and not a spectral input) should shout at you for trying to feed it a spectrum
3 Likes

If you simulate that,then Fresnel equations are the start,how much the material reflecting and refracting light.
Btw.
I have read some papers about Fresnel roughness,and it is described that even smooth looking materials have some roughness imperfections at nanometre level and higher like micrometer.These microroughness causes a drop in reflecting intensity.There is rarly a perfect smooth material even in a labor at measuement.For this reason i believe this is a one of the most overseen optical effects in rendering.
On the other hand you can have the opposite effect,with water IE where at the grazing angle at a wet rainy street you get these anisotropic long reflections,which gets sharper at a far away light source.(kind of dispersion)