Jett's Sketchbook: Fixing the Spectral Thin-Films

(JettG_G) #1

Thumbnail Update:

Hey everyone! Hope you have fun looking at whatever projects I post here.


1 Like

(JettG_G) #2

Here’s another illusion for you. Can you spot the seams?


Man, the JPG really takes the quality down a notch, huh?


(JettG_G) #3

Here is a bubble I made using a thin-film shader I adapted! Sadly, even at 3000 samples, some of the reflections are still noisy. I would denoise it, but it produced really bad artifacts around some of the brighter reflections. Later, I’ll be able to render it with more samples… unless someone has another idea for reducing the noise!


HDRI from HDRI Haven
Also, I’ll be posting the node group soon (based off of Pruster’s code). Look forward to it!


(JettG_G) #4

I made a simple animation with the thin-film shader! Of course, it’s of a bubble.


Still frame:

I realize the movement of the colors are very fast, but at this point, I’m too lazy to fix it. I will say, I think I did improve the material from the render in the post above, the lighting here is also better for bubble reflections (albeit, with some trickery), and it does make a perfect loop! (I also figured out some denoising settings that actually worked but, it seems, only in this specific render)


Maybe I should have looped it in the Youtube video to demonstrate that while still keeping the quality… something to keep in mind for later, I guess.

Also, if you would like to try out the shader, click this download link: Thin-Film Interference.blend (5.37 MB)
Hope you guys enjoy using it!


(m_squared) #5

copper and chromium pictures are looking really good. well done and keep it going! :smiley:


(JettG_G) #6

@m_squared, Thank you! I want to make more optical illusions soon.


So after a few months of mulling on the interference node group and trying to make sure it’s perfect, I think it is finally finished for now. I had a great time doing the research, deciphering script, and building it; I’m proud with how it turned out.

Here’s the link to download it:

@pruster, Thanks for the initial script you created which helped me so much throughout the process. Oh, and I won’t forget you ported over the materials you created with your interference script when I couldn’t!

Here’s the link to find the original script:

Hope you all enjoy it!


(JettG_G) #7

After some looking into some methods for creating a relatively more realistic glass material, I was able to create glass with dispersion and absorption.

For dispersion, I never really did like the method of combining three different glasses, so I took inspiration from this method of using a texture to mimic the use of different IORs and Glass colors. The texture is from a modified pixel texture.

For absorption, I modified the node groups from these two sources: 1 and 2.

The node group is still unfinished, but I will eventually post it. Right now, I’m looking to refine the nodes more and maybe add some caustics effects. And due to the small scale texture, the render does stay a little noisy even at high render samples, so I find it’s best to always denoise the image. Of course, the final goal is to look as good as the Prism glass shader on the Blender Market.


At some point (which of course, may turn out to be never), I’m going to draw a simple fish swimming around in it.


(mooopstar) #8

and it s perfect my friend ! I ve just loaded these materials in and don t trust my eyes. this is a masterpiece, I m really impressed!
Thank you for sharing

1 Like

(JettG_G) #9

It’s been more than a year since I last posted, and I want to get back into it.

I’ve been working on a possible extension/update for the thin film interference nodes, and part of it has already been completed. It allows one to simulate the repetition of a stack of thin films.

Imagine it like this:
1 unit stack: → A B C →
3 unit stack: → (A B C) (A B C) (A B C) →

Using a formula for a matrix to the nth power, any number of repetitions can be simulated. This means we can more accurately simulate materials with more extensive thin film structures, such as a pearl.

There are some limitations which I might talk about later, but for now, I would love to hear some feed back about the new pearl material made with the new nodes:

Which material looks the most pearl-like to you?


(JettG_G) #10

After making the pearl material, I decided to try to implement the spectral calculation formulas found here: Click!

Unfortunately, I have been unable to generalize the formulas to multiple layers and lossy films, much less the 100s of layers used for the pearl material. I was able to implement the calculations in the paper, so it’s a start.

Here’s a linear thickness gradient–50 to 1000 nm–of a SiO2 layer on Si:

Top: Interference calculated with 3 samples (the current nodes)
Middle: Colors from the chart here
Bottom: Spectral calculations

The new spectral calculations better correspond to the chart’s colors. Also, at increasing thicknesses, the colors do eventually converge instead of creating the many banded texture that the original calculations do.

0 to 15 microns:

Top: Interference calculated with 3 samples (current nodes)
Bottom: Spectral calculations

I think it’s really interesting to see clear cutoffs in the spectral calculations. Before the first cutoff, the colors appear to even increase in brightness. If the cause for these are not the fit functions I use in the calculations, I wonder what the physical meaning is; I expected the convergence to be gradual.

Edit: Looking back at the paper, it seems the convergence is gradual, but to get those results, I might need to perform another integration…


(JettG_G) #11

Silly me! The reason the convergence wasn’t gradual was because of the fit functions. Namely, I sent the wrong calculations into the output. Coincidentally, even with the incorrect output, the test comparisons to the chart still matched. Here’s an update of the silicon image:

Top: Functions w/ mistake
Middle: Colors from the chart
Bottom: Corrected functions

The colors are less saturated, but they still roughly match the what’s on the chart. I just find it funny that the incorrect one worked so well.

In the following render, the thickness only reaches 2000 nm to converge. It makes much more sense than the 15 micron shenanigans.

Top: Interference calculated with 3 samples (current nodes)
Bottom: Corrected functions

I also tested whether using more accurate fit functions at the cost of a little speed was worth it. It’s not.

Top: Difference between the tests
Middle: Less accurate functions
Bottom: More accurate functions

The difference may seem non-negligible, but, in reality, no one will ever notice.


(pixelgrip) #12

nice tests,i wonder if your calculations takeing wave amplitude doubleing and out cancleing into account,especially that would make a difference in color intensity.

the color chart in your last post, shows a little shift the thicker the material gets to the right.the reason for this is that the tri chromatic lambdas are not in the same wavelength “distance” to each other.just try to change one lambda and its IOR and k value,then you see a difference in color distriburtion.

i guess it would be optimal, if you have the original IOR values and its lambdas from the colorchart tests,to get as close as possible with your test renderings,and as comparsion how accurate your current calculations are at the moment.

for speeding things up,your middle render in the last render test are good enough.


(JettG_G) #13


The canceling and doubling of the wave amplitudes should be working correctly. If I understand correctly, the reason it becomes less saturated is due to the color fringes produced by different wavelengths overlapping and averaging out.

The shift is actually moreso due to the chart being given with uneven intervals between each color, while the gradient is evenly spaced. Though, the colors it has difficulty replicating seem to be the nearly white ones.

Yeah, it would likely be best to calculate the colors with the correct IOR values and compare those to the node group. I wonder how closely the node group approximates the true colors. That could be fun to test and compare!