GPU Compatible Thin-Film Interference v2.1: Glass Within Glass + Absorption

Hmm… I it’s a little bit of both but moreso a port, because at some point I relied less on the literature and more on the code to help me finish. Well, I’ll keep the license, because I wouldn’t want anyone making money off the node group I intended to be free. And if anyone else notices any mistakes or possible avenues for speed improvements, definitely say something!

I found a small error I made with reimplementing the space helmet material: the roughness now defaults to 0.5, whereas it should be 0.

Whoops, thanks for telling me! It should be updated now.

Well I made the error :smiley:


Congrats prutser , Your job is amazing! Downloaded now.
At soon…:eyebrowlift:

I downloaded a fresh copy from your dropbox link, but could it be that it still seems to have the roughness at 0.5 for the space helmet material?

Oh wait, I see what you mean. I originally thought you meant that the node group itself defaulted to .5 (which it did and shouldn’t have for the most correct results). Updated!

Right, that actually also makes sense! Thanks for that. Then a (last?) thingy: while fixing it seems that the glossy shader in the space helmet material inadvertently got bypassed :slight_smile:

Haha, oh no! I was using the transmission color to test some tiny change I made in the node group, and I forgot to correct the material output. Now, everything should be correct.

Hey everyone, I hope you are all have a good time this holiday season!

I created a new node group for conductors without films on them and added it as an option for any of the applicable materials. This should speed up your renders if only by a little.

It should be updated in the first post for you guys to download. If anyone notices any problems, please tell me! Hope you all enjoy!

Edit: Soon, I’ll be adding an output to the interference node group for situations like this in which one would only want the substrate.

I have updated the node group so that one can now access the color of only the substrate (0 layers) should they find that having the layers is not necessary for their purposes and want to speed up their render. Enjoy!

Thanks again, and best wishes for the new year :slight_smile:

PS… Notify blendernation :wink:

Thanks for reminding me about that!

So I made another update and added two more materials. The first one simulates a single layer thin-film on a dielectric substrate, the color of which can be changed. The second material… is the same thing but for two layers.

To accommodate for these materials, I added another output on the interference node for dielectric-substrate fresnel calculations. Sure, I could have used the already built-in fresnel input node, but with the way I was calculating roughness for everything else, I wanted everything to be consistent. It’s also faster than using the previous substrate-only output to calculate a dielectric surface.

Again, If anyone notices any mistakes, please tell me!


@JettG_G I’ve tried to compare results from your node group to the ones from this paper: and for the first part from 5. Appearance Range results are probably the same or nearly the same but after adding k value for conducting base (aside of k = 0) results are completely different. Check my setup, probably I’m doing something wrong:

I took a look at the paper you linked and the paper it’s a supplement to, and one of the key differences (if I understand it correctly) is that they are rendering their results spectrally. Since we are only able to take 3 values for each material, we can, unfortunately, only look at a tiny snippet of the spectrum.

One way you can quickly test this is by making n3=1.45, k3=0, n2=1.330, and then increase D1 by 1000 (no need to plug the output into anything). Check the results as you increase the thickness. At some point, the bands of color you see are supposed to go away when the thickness shouldn’t be able to support interference, but it doesn’t in Cycles. The colors of the bands do eventually combine to form the simpler fresnel of a dielectric with n=1.45, but you can see artifacts as a result of the bands still existing.

So, unfortunately, there will be some materials which this node group cannot correctly simulate.

@JettG_G Yeah, I know that this is suplement but I assumed you have stumble upon this paper before. For those whom don’t know it yet:

I understand it that they are not using spectral renderer but use it as a comparison:

Thin film iridescence permits to reproduce the appearance of leather. However, this theory requires spectral rendering engines (such as Maxwell Render) to correctly integrate the change of appearance with respect to viewpoint (known as goniochromatism). This is due to aliasing in the spectral domain as real-time renderers only work with three components (RGB) for the entire range of visible light. In this work, we show how to anti-alias a thin-film model, how to incorporate it in microfacet theory, and how to integrate it in a real-time rendering engine. This widens the range of reproducible appearances with microfacet models.

Our materialmodel is the first to produce a consistent appearance between tristimulus(e.g., RGB) and spectral rendering engines by analytically pre-integrating itsspectral response.

So what you are trying to tell me is that thin-film layer over conducting base isn’t possible “correctly” with your node group at all?
Or in other words how for example adding thin-film layer to any of conductors you’ve provided is “physically correct”?

And last question is about heated iron from your blend file. You have used there two Interference groups without thin-film layer so I’ve wondered why is that and go back to our supplement I’ve tried to reproduce point 6 - Steel Tampering. Here are the results:

It looks like color spectrum is shifted by one place (value?).

Essentially, yes. It is basically only correct for the RGB values it is given, but I think for most purposes, it should hold up okay (like in the heated iron example you tested where it looks pretty close).

Oh, and I think in the paper they are comparing their way of rendering something spectrally to an actual spectral renderer. They were able to pre-integrate the spectral response for each RGB color which allowed them to render more correct colors, thereby being closer to the spectral renderer.

The top interference group is for the thin-film, and the bottom one is for just the iron metal. They are mixed so that the unnecessary parts of the material don’t show up (you can see it when you view just the top node).

The shift in the color spectrum is also probably due to the inability to render spectrally.

Edit: Before, trying to understand all the analytic spectral integration stuff in that paper was really hard, so I pretty much skipped it when I tested out their interference equation (which gave the exact same result as the equation I used from Pruster). After getting another good look through it, I think it might be doable in Blender…

Are you serious? :slight_smile: This would be amazing! Especially that they are showing (check their video) real time examples (big wink to EEVEE).
And taking that thin-film would be possible over conductive materials… I will be speechless if it will happen.

Unless I’m misunderstanding it, I think this is the equation they used which should be doable in Blender:

I’ve actually already started my attempt at implementing it, but the ‘cos Φ’ is confusing me at the moment.

JettG_G’s node group does do thin films over conductive materials and it’s physically 100% correct for the three wavelengths stated. In fact, your own test shows how incredibly well JettG_G’s node group matches the paper’s results when it comes to the steel tempering. This shift is really negligible as it’s about getting the pretty colors, right? Also note that for the space helmet material, the gold reflection is actually more orange than pure gold. This is actually true and physically correct. Thin layers of gold reflect a different spectrum than solid gold, and transmit a greenish light. Cycles recreates it pretty nicely. Also see the Nature Materials GeAu layered material. The exact layer thicknesses don’t match the experiment but they are pretty close and the colors shift in the same way. That cycles is off by a few nanometers because of rendering in RGB is hardly a problem.

Cycles is not a spectral renderer, and implementing the same technique as in the paper means that you have to assume a spectral shape of each light source in your scene and do the integration for it (as Cycles’ lights don’t have a spectrum). Therefore, as JettG_G also stated, unless you make the films very thick, the results are remarkably accurate. With thicker films the effect should fade which is easily simulated with a normal glossy shader mixed in with increasing thickness.

I’d say better use it as-is instead of waiting for the next best thing :wink: