Adapting Pruster's Thin-Film Code

(JettG_G) #1

Hey everyone! After a couple months of researching and trying to understand code, I was finally able to adapt Pruster’s code for thin-films into a node group for GPU purposes.

Here is the original thread:

Here is the blend file:

Here’s an animation of a bubble I made with it as an example of how it looks:

Still frame:

Hey everyone: Here’s a link to the attempt at a spectral interference node group I’ve been toying around with:

(prutser) #2

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

(JettG_G) #3

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.

(pixelgrip) #4

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

(burnin) #5

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

(pixelgrip) #6

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.

(JettG_G) #7

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.

(prutser) #8

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?

(JettG_G) #9

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).

(prutser) #10

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

(Hoverkraft) #11

You guys are great. Just sayin’

(JettG_G) #12

That would be pretty awesome, thanks!

(prutser) #13

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:


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!

(greitibatai) #14

This node connects nowhere?

(JettG_G) #15

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!

(JettG_G) #16

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!

(English is not my native language) #18

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.

(JettG_G) #19

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.

(prutser) #20

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.