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

Update Pending: See post 72 for update v2.2

Hey everyone! Welcome to the colorful update of v2.1 of the thin-film interference node group which was originally adapted from @prutser’s OSL code.

Here is pruster’s original thread.

This new update generalizes Snell’s law for lossy incident media (such that R+T is always 1 when the films are not lossy), adds absorption, and allows the dielectric inputs and outputs to be calculated with RGB values like everything else.

Only the “Interference”/“Thin-Film Interference” node group is under a CC BY-NC-SA 4.0 license, but its output can be used for any purpose:
Here is v2.1 (most recent update: 8/21/18 4:15 a.m. ET)
Here is v2.0
Here is v1.0

10 new materials, 9 of which are examples of what situations you can simulate with the node group, have been added:

(All rendered at 500 samples)


There are many, many more combinations of substrate and surrounding media that you can simulate–not to mention all the possibilities of films you can add!


While the render times might be slightly different, the results for previous materials from v2.0 should appear exactly the same as in v2.1, so the following images are still correct (the glass results from v2.0 onward are less noisy and very slightly brighter):

Respective render times (min): 9:33.97 and 7:10.44 (500 smaples)

Respective render times (min): 6:49.82 and 4:44.92 (500 smaples)


Future possible updates (in no particular order):

  • Substrate roughness: find a roughness curve that mimics the (square root of the) roughness of the principled shader
  • Roughness in a film: not necessarily the same as the substrate roughness due to the interference effects (can probably be simulated well with large scale textures as the thickness input)

Enjoy using the materials and node group!

17 Likes

Lovely, gonna play around with it and cross check the results! Terrible job to do, I’m happy you did it :slight_smile:

1 Like

Despite some of the frustration, I had a lot of fun creating it! Oh, and I hope you enjoy the roughness setting I implemented into it. I figured, instead of having two separate outputs for roughnesses at opposite extremes, why not have the ability to interpolate between the two (even if not exactly accurate)?

Edit: Oh, and being able to alter the fresnel in this way in combination with the microsurface roughness stuff found in this thread, I think it might produce some pretty cool stuff.

Congrats,i know how difficult it can be,to rebuild a code with cycles nodes.download now…

What an amazing deed, wonderful world… great gift!
TYVM… to all :smiley:

i have tryed a few short tests ,and have looked in your node groups.nice work with the nodes.more material presets would be nice to have.

Ah yeah, I thought of making some material presets, but I was too lazy to do so. I’ll see what I can do later.

I’ve tried your node and my OSL code for the space helmet, and the results seem to be virtually the same! Excellent! So how about we put the material presets in my .blend file of the OSL code as node materials in yours?

Edit: one comment - maybe calling inputs T1 and T2 and outputs T1 and T2 isn’t the best idea as they have very different meanings?

Oh man, I hadn’t even realized they were the same! Thanks for pointing that out. But yeah, I agree that using your material presets would be a nice solution. I’ll hopefully get to doing that sometime this week (er, well, maybe this month).

I wouldn’t mind doing that for you. I have a ten hour flight ahead of me :slight_smile:

You guys are great. Just sayin’

That would be pretty awesome, thanks!

There, I think it’s done. I believe your nodes are working great! I haven’t seen any discrepancies and it’s way faster on my machine than the OSL code. Thanks again! Btw, have you done benchmarking to see whether the single layer is faster without the nodes for the second layer? Or does Cycles optimize out nodes that aren’t connected?

Here’s the file:

Cheers!

Btw JettG_G: post a news item on blendernation, Bart included my work before and I think this is a significant update for more people to see!

1 Like

This node connects nowhere?


Wow, great work, Pruster! I’ve updated the original post to include the new file. I was also actually able to find a way to not require users to always input a normal into the node group, and I went ahead and deleted any unnecessary geometry input nodes.

I haven’t done any real benchmark tests, but the single layer outputs do render faster than the double layer outputs. I guess it’s safe to say that Cycles does optimize out the unconnected nodes.

So I realize that for your code you put a CC BY-NC-SA 4.0 license, but allowed the output itself to be used for anything. I looked up the license requirements and because it is essentially a transformation of your code, that would also make the node group itself have the same license, correct?

Oh, and I can try posting a news item there once I figure out the licensing stuff!

Woah, good eye! That’s there so that if someone needed to, they could choose which solution they want to use. Complex powers of the form (a+ib)^(1/n) have n number of solutions to them. The file should be updated with the correction now.

By the way, can someone check to see if the dropbox link allows them to download the file? I tried the link in incognito, but it requires me to login to be able to access it even though the settings say anyone with the link can view the file.

Yes, the link works, even so dropbox want you to login after pressing the download button, but you can close it and press again, then it worked for me without login.

Great work guys!

Thank you very much JettG_G and prutser!
About thumbnail, you must delete old image from Attachments in your user settings, otherwise it will continue to appear.
Regarding Dropbox, there is usually a floating window asking for login, but you can close that window and then download the file anyway. But your link in Firefox does not appear that floating window, only the main screen asking for login. You being in your dropbox account, in the file you want to share on the right there should be a “create link” button or something like this, and then another copy link button. That is the link that you must share here.

I knew deleting the attachment from the post would remove it, but I never realized deleting it from my user settings would work! Thanks!

Also, thanks for testing the link. On my computer, the link it gave me was the link it that it made after I clicked “create link”, but for some reason it wasn’t working as expected. Anyway, the new link is from the dropbox app, and I think it should be working properly now. Thanks, guys.

You’re welcome, and thank you for the improvements! With respect to the license… I guess? You know best whether it’s a port or a independent implementation. I chose CC BY-NC-SA 4.0 to prevent anyone from making money from the code, but not from the images that can be produced with it.

Cheers!