Cycles Spectral Rendering

Hi, I disoverd your thread just now, after searching for the possibility to enhance my blender renderers.

At some point you can do what ever you want, you will never reach pure realism with what is built it in cycle, I learned that pretty fast.

Amazing work so far from you. I´m glad that somebody already took the effort to dive into this. I really can´t understand why people don´t use the spectral render engines, they always talk about photorealistic renderings, but don´t implement spectral rendering!

I don´t understand how you do it, are you doing programming or are you building nodetrees to handel the light data correctly?

Thank you for your hard work again!

i guess you have seen this papers and code ?

http://momentsingraphics.de/Siggraph2019.html
http://momentsingraphics.de/MAM2019.html

svbrdf database and papers
https://cg.cs.uni-bonn.de/de/projekte/svbrdf-database-bonn/

I was initially using nodes to do all of this. A simple version of it is possible with just nodes, but the performance of it is much worse than what can be achieved in code. I later started modifying Cycles code in order to implement it properly, which is an ongoing effort.

2 Likes

Yep, the work on moments is pretty interesting. I have experimented with a 3-coefficient representation of spectra which seems like good option if writing a new engine. Retrofitting something like that onto Cycles wouldn’t be worth it though.

Would you mind sharing some images of the nodes from the bubble and burnt metal shaders so that I can understand how you achieved them?

I’m happy to but they might not be what you expect. By ‘using nodes’ what I really mean is that I create all materials in greyscale but changes slightly based on the ‘wavelength’ being rendered. Then I brought all those images back in to the compositor and combined them together with their corresponding wavelength.

The concept behind the materials comes from ‘thin film interference’, so based on the angle, wavelength, IOR of each material, and thickness of the film, you can work out a percentage of light that is transmitted and reflected. Because the transmission amount depends on the wavelength, it looks colourful. Understanding the thin film equation should give you the knowledge you need to be able to create such a material, but any attempt to do it in a regular RGB renderer will be confusing because there are so many unanswerable questions.

1 Like

Could you please send .blend file, so it would be easier to understand process of creation such materials as you did?

Inspired by the unterwater topic at https://devtalk.blender.org/t/thoughts-on-making-cycles-into-a-spectral-renderer/2192/678

i made some test render,with latest daily git build blender 2.90.2 for rgb renderings,and the latest spectral build from graphicall

for this test i modeled a simple tank which is 50m deep with a marbletexture around, to avoid lighting from the site or unterneath.
in this tank i added a volume absorption with real absorption values from measured clear water.for the light i used a sun light with 1000 watts,to get real sun light strength.i adjusted the exposure at the outside from the watertank,to a filmic grey (.18) to make sure the light intensity at the watersurface is correct (as correct this test can be ofcourse).

i loaded the image from the dev blender site topic as image as plane,and reduced the specular from the image to 0 to avoid reflection errors.

i have parent the camera above 1m to the plane image with a widelens of 11mm (very similar to the video)

keep in mind i left the exposure to the adjustment at the surface,this is why there appear darker the deeper its get.
here the render.
rgb 10m underneath the watersurface


spectral 10m underneath the watersurface

rgb 50m underwater

spectral 50m underwater

the image used for the test

edit,spectral 50m underwater with exposure adjustment (i am guess the camera from the video has a auto exposure on)

5 Likes

That’s a pretty nice test! Thanks for conducting it.

I think once I have a ‘spectrum curves’ node (what I’m working on now) that will allow us to specify the absorption spectrum much more accurately, as currently even the spectral version is using an RGB to spectrum upsampling process which is obviously not as accurate as using the real values. Still, the colour from the spectral result looks much more pleasing to me.

I’ll let you know once custom spectra can be used (which will also open the doors to cool experiments like fluorescent lighting).

1 Like

Hi, sorry I didn’t get back to you on this one. I’ve been trying to find the files but haven’t found them after a computer change :frowning: The process should be relatively well documented above if you want to follow along, but soon enough the spectral build will be capable of very similar things.

1 Like

its fun,here another test.i found a interesting paper,here some reference shots at 6m waterdeep from.
i am not sure if the guys who hat shot this images are using camera lighting,i guess this could aldulterated the colors,if the lamps gives some red wavelength back ie.however here the images.

and spectral render at 6m underwater,with exposure adjusment to the reference foto.


it seems red is weaker vs reference images,could be as sayed from the camera lighting.

yeah,fluorescent would be great,then the first fishbait rendertest would be more accurate.
edit,next test


spectral 31,7m deep.only scattering and anisotropy of clearwater.sry for some noise.

yes, spectrum curve nodes would be great too.i hope it would be possible, to set as many absorption points as you want.this way you could rebuild full spectral absorption measurements you could find in the net.especially if you make it possible to render fluorescent light,you could make the wavelength spectrum more wide in the node too.UV-VIS-IR (ie)

and yes to me the whole spectral colors of the test renderings are closer to the fotos vs the rgb renderings.the spectral gives instant a realness,vs the rgb is that lacking.

1 Like

For those interested, there is now a build which contains a ‘Spectral Curves’ node (found in the colour node dropdown) which can be plugged into any BSDF colour socket. This will allow for a much more varied set of imagery to be created than before.

https://blender.community/c/graphicall/nkbbbc/

There’s a problem with the build right now, I’ll try to fix it as quickly as possible

1 Like

I managed to solve fftw3-3 error but I cant find node you mentioned. :pensive:

i have read the topic at dev blend about negative wavelength.usally its represent the path length,means peer unit path length,that amount of energie gets absorped.(ie)if you have the absorption spectrum of water with m-1 in the graph,then the absorpion means that wavelegth geths absorped peer meter path length with a intensity lost shown in the y axis at the graph(thats the negative absorption peer m) .in our case with scatter or absorption shader peer m or BU.

here the absorption coefficent spectrum of water m-1
Water_light_absorption_coefficient

good explanation

further the absorption is usally a attenuation of the wavelength amplitude.based on beer lamberts law.
e ^wavelength m-1(the negative intensity at its wavelegth) * pathlength(simplified)

if a light ray goes trough the volume ,then the ray intensity multiplyed by the formula above,you get the attenuated intensity in the medium.

1 Like

Oh, you’ve managed to get it building? If so, the node should be in Colour, at the bottom. If you’ve just downloaded the latest build from GraphicAll, because there is an issue building, it is not yet up to date and doesn’t contain the spectral colour node.

I’ll have to look into it, thanks for the link!

Yes I downloaded one which had libfftw3f-3.dll file missing. I will wait for the next build then. Thank you!

i think i found a small bug.in this test the absorption values in all 3 rgb channels are 0.0001.the sun light has a color of white (1,1,1).high densitys,in this case 100 gives this greenish color,expected color is neutral grey absorption.

Yeah that is weird, I wonder why that’s happening :thinking: