Micro/angle dependent Roughness & Iridescence

Moony, would there be a reason to believe that if we calculated the interfarence for the wavelenghts of RGB primaries and combined the result to RGB it would be correct representation of the effect? Or is it different when an obect is illuminated by a wide range of different wavelegths?

Not without patching and compiling from source.
The equation needs the output vector from the closure to be correctly calculated, and unfortunately we only have access to that inside the closure call.

The problem remains the same with or without OSL… We don’t have access to the output vector of rough surfaces. I already posted a few years ago an OSL script for diffraction, but it only forces the roughness by manipulating the normals, which is not a good way to do it (it’s a brut force technic). In the source code, we have access to the output vector which makes it very easy to calculate (and use any acceleration from the kernel, i.e. MIS or direct light sampling), and that’s why iridescence should be done in the source.

On the other hand, OSL will probably have the ability to program closures (it’s on the intention list). When that happens we can be very happy.

@moony, that ColorPy page is quite interesting! thanks for the link.

I don’t think so since the angle of incident light is also important, not just the angle of the viewer (and I don’t think we can access that)

From the silicon thin layer paper

“The color of the dielectric film on silicon depends on the incident angle of the light source, theluminance of the source, the thickness of the dielectric film, and the dielectric material”

That was a silly question, I see now reading the papers.

No probs.

What do you think of my node group based upon it. It’s a bit hacky and the controls aren’t really physically based - but seems to give quite aesthetically pleasing results:

Attachments

irid3.blend (575 KB)

I have managed to produced an iridescent material that did respond to the incident light - by subtracting glossy shaders :smiley:

It’s very basic and uses the same principle as dispersion glass, as opposed to thin film approximations - but the results are quite interesting, if a little niche:

Actually - I wonder if I can combine the technique used in my nodegroup above with the glossy subtraction technique?

I think I am starting to see the problem… :smiley:

Just doing some more testing on the sine wave addition test. Using a wave texture and a gradient texture - I can get a fair representation of the SiO2 colour gradient from earlier (at least it’s pretty good on the left hand side).


This is the node setup i’m using to test this:


@Secrop,thanks for clarification.

here a test with moonys node form post #149.i have deleted the inverted map and feeded the scale inputs with different n ior values for r g and b seperatly.values taken from refractive index side and the diesel soot material.i used 0,700 0,530 and 0,470 um for the rgb ior.

https://refractiveindex.info/?shelf=3d&book=misc&page=diesel_soot


edit,feeded diamond ior in the inputs


This is incorrect in both cases. Iridescence is an effect that depends on viewing angle and one would not see this on a diamond. What you see on diamonds is dispersion.

Yep - there is no angle dependent term on the monkey material - it looks like the wave texture is just being applied as is.

For clarification - the wave texture material was a proof of concept only. It was designed to show whether or not the RGB sine wave addition method could accurately reproduce the colour gradients given in the papers linked earlier. It was never designed to be used as an actual material.

My hope was that if I could show that the sine wave addition worked and could accurately reproduce the colours of a thin film of varying thickness - that we could substitute the hard coded colour ramp used in the material I posted in post #129 and therefore allow a greater level of control.

Even better - if I could figure out what the sine wave offsets should be in relation to IOR of the thin film and substrate - this would, in theory, allow you to re-create any arbitrary thin film of any arbitrary substrate - just as long as you know the IORs of the materials in question.

Pixelgrip: If you want a proper diamond dispersion material - check this one out that I did a few weeks back (it’s about 1/3rd faster at rendering than the traditional RGB glass addition method too).

This is the principle i’m trying to use:

For each wavelength - you get a pattern of rings cause by constructive or destructive interference.

Add up the patterns for all wavelengths and you get iridescent rainbow patterns.

Well, you can recreate the RGB values using math, but what then? How do you get that RGB pattern from IOR values?

Good question :smiley:

Perhaps the Python code posted in one of the links I provided earlier may be able to give us a clue how to do the conversion - after all they are using this code to generate theoretical thin film colour ramps from IOR values.

Anyway - here is another test of this concept. I think this approach is valid (at least from an artistic viewpoint), we just need to figure out how whether it can be translated into physical values.


who sayed i wanted to post a complete view depending shader ?:no:

as i posted,yes its just moonys node applyed,but with 3 different ior values for each rgb channel ,calculated in refractiveindex page.just to see how it looks.btw the diamond was rendered with reflection vector.

I am thinking if the interference is calculated only for the wavelengths of RGB primaries how far the result of this approximation would be from reality where an object is illuminated by a more complex source… RGB LED lights are used in lighting a lot and we still see stuff…

Whilst this is true in reality - Cycles is an RGB renderer as opposed to spectral, so we have to approximate real world effects within that constraint for the moment.

I kinda see what you are doing now. I’ll give your node group a try and see if the IORs translate correctly.

im not exatly sure want you want to archive.thickness? in the end its only the visible spectrum of wavelenghts with differend frequencys in the wavepattern from the 3 rgb ior ? where are you get thickness values for most used materials ?

anyway thanks for the diamond link,here the same monky with reflection vector


edit,im not sure about the scale value in the mapping node.this has a huge influence how the big the waves appear.for now i just put in the ior value.for physical correctness i think that scaling needs to be in the nm or micro mm .but i guess thats to small for cycles.