Thoughts on making Cycles into a spectral renderer

Yep looking at that I’ve been considering whether there might be alternative spectrum construction UIs that are more suitable to this sort of work, like if there was a slider which controlled the exponential ‘optical depth’ of the spectrum, essentially raising all values to a power but retaining the ability to edit the spectrum.

As for perceptual uniformity of the spectrum node, once my work on gamut mapping is complete I should have a hue-constant colour space which can be turned into a spectrally based HSL wheel, which will generate Gaussian spectra and allow users to select any ‘real’ Gaussian spectrum as a single 3-dimensional value. This hopefully should retain a much more perceptually uniform distribution of hues and be more intuitive to work with than the spectrum node, which I suspect will be used in more scientific cases.

1 Like

This will be great of course, but I’m specifically thinking for arbitrary spectra like the above.

Yeah it’s an interesting problem. It’s definitely something I’m interested in looking in to, but as you said it’s likely something which will come later, once we know what the biggest pain points are.

Some time ago bsdfs with roughness property have been changed to use roughness squared, which to our eyes look more gradual, whereas the old version (not squared) would appear to suddenly jump in roughness at some point between 0 and 1. So in effect artists had to fiddle with very small values if they wanted just a little bit of roughness.
The new system is more intuitive because it is made to match our perception, and that’s also the rationale behind the principled bsdf -I think your reasoning is in line with that : having some kind of a compensation for the spectrum curves that makes it “stronger” around the ends, and “weaker” (less sensitive) in the central, more strongly perceived colors, seems sane to me.

@smilebags Hi,I wonder if I can create triangular prism dispersion using this version. If the answer is yes, how should I set up the scene ?

There’s no dispersion support yet, so unfortunately this isn’t yet possible. We do plan to add support for dispersion in the future, so once it is in, it will be very straight forward to create a scene like you described.

At this moment it doesn’t support gpu so it’s really time-consuming to do some tests.

And to be clear, that means we get a BSDF that has wavelength-dependent IOR. Not that we’ll get a rendering engine that’d actually be any good at showing off caustics

3 Likes

A new build is available on GraphicAll. Changes:

  • Fixed vector to spectral socket conversion
  • Increased wavelength importance sampling resolution
  • Improved quality of the default CRF preset
  • Fixed “Subsurface Radius” socket not displaying as spectral in Blender UI
  • CUDA kernels are now compiled with CUDA v11.1
  • Updated Blender
9 Likes

You should apply the “CIE 1931 Standart Observer” preset as it has a much better resolution. The default one (when creating a new file) should have the same resolution now. For the old files, the preset should be applied.
I also increased the wavelength importance sampling table resolution from 1024 to 4096. Here’s a comparison:


5 Likes

Thanks for the update and that new test. Its interesting to see how the chart responded to the greater CDF resolution.

@smilebags I notice that sometimes when I open spectral cuve node,there is only black image behind the curve,is this a bug ?

Image 1
I am not very familiar with spectral cuve,if I pull the current selected point up,it’s always white.If I pull it a little bit down,it goes blue.Is this a problem?

I can’t reproduce this,maybe some addon have conflict with this.

I’ve seen this happen as well. Not entirely sure when it happens.
But if I go to the panel where I could, in principle, mess with the camera response function, that will also appear black for a moment but then reload the background image, and once it does that, so does the background in the nodes.

Where would I do that?

So if I get that right, while it’s way better, even now the extreme end of the red spectrum practically won’t ever be sampled. As long as that’s true, would widening the sampling spectrum even make a difference?

Not sure it actually matters in most cases of course. The far end of the spectrum is very dark to our eyes and will rarely appreciably contribute anyway. But effectively, the sampling isn’t actually what it’s supposed to be.

Maybe it would make sense to update the image of the spectral branch?
If it’s to be the exact same thing, then here is the same render but rendered with this latest build and without noise:


But perhaps it’d also make sense to use something else

I’ve been tossing up options for how we should tackle this and I think I have a solution that should work, but importance sampling may suffer a tiny bit.

Increase the ‘importance’ of all wavelengths by a constant amount, such that areas with very low importance (far blues and far reds) get a significant increase in importance, while green will not gain any noticeable increase. This will mean the darker wavelengths will be over-sampled according to their brightness, but should fix this issue. I’ll see whether I can implement this and verify that it works.

I’m also going to try to simultaneously fix the banding - right now we’re treating the importance sampling CDF as if it’s identical to the luminosity of each wavelength, hence the resolution causing visible bands. We must sample all wavelengths within the range occasionally, even if very rarely, which doesn’t seem to be happening now. If I succeed in what I intend to do, the brightness gradient should become smooth - we should only get bands of differing noise levels.

Once this is resolved, extending the sampling range should give us the marginal improvement that it was intended to. Right now you’re right, it wouldn’t do us much good, if any.

1 Like

If anyone wants to create/propose a new image for the branch I’m sure we can swap it out :smile:

@kram1032 do you have that spectrum in EXR? If so is there some way you could send it to me, or alternatively process it with regular Filmic and post what it looks like? I wonder how it’ll treat bright and out of gamut colours. I imagine it’ll be significantly better but still have some issues.

If you mean the spectrum pembem22 showed off, I think that’s a recreation? I can certainly redo it in the latest version.
If you mean my own render of it, from an earlier version of the branch, I already linked the exr in this reply: