Rendering refractive surfaces with jf_nested_dielectric

jf_nested_dielectric_arnold

Rendering refractive surfaces in arnold with the default shader can be really frustrating, render times can go up really fast and depending on your scene a lot of noise is introduced which is hard to clean even in high quality settings. The jf_nested_dielectric arnold shader is the perfect solution for refractive surfaces, in this post I am going to share a few tips about this shader.

Scene setup

maya bottle scene

In this scene I have a bottle that has some thickness, and the inner surface (liquid) that should overlap the outer surface. For the lighting I am just using a SkyDomeLight with an hdri.

Jf_nested_dielectric shader

medium priority

The first setting you find in this shader is Medium priority. So I have 2 shaders, one green glass for the bottle and an orange-ish for the liquid. In the image above you can see how the medium priority setting is affecting the look. With both shaders set to 0 the render looks like we don’t have enough refraction rays, but that’s not the problem. You will have to set one of the shaders to be 1 and other to 0, in this case setting the bottle shader to 1 and liquid to 0 will “show more” the liquid through the glass.

You also have to set Medium IOR, which as you know is the refraction index, simple enough.

medium transmittance scale

The next setting is Transmission. If you used vray before this is similar to the fog settings in the VrayMtl. You set a color in the medium transmittance color and in the scale factor you adjust how “thick” is the surface. This setting is also dependent on scene scale.

roughness

Then you have refraction roughness and specular roughness which is something common in any shader. For the liquid material I used refraction roughness to give it a “thicker” look.

sky behaviors

By default the jf_nest_dielectric shader doesn’t refract Skydome Lights, depending on your lighting/scene setup you might need to turn this setting on, you can clearly see the affect of this setting in the image above.

Render Settings

arnold render settings aovs

Don’t forget to set enough refraction rays in the render settings. You also get AOV’s for this particular shader.

waterdrops

I was not able to render refractive particles for the water drops, so I had to convert them to polygons and play with the output mesh settings. This was also usefull to give a more random look to the waterdrops since particles render as perfect spheres.

Final Render

final render arnold

You still have a lot of settings to explore in this shader, I just wanted to share what I have used so far, let me know if you find this useful and please leave a comment if you have any suggestions or questions. Thank you.

External links

Official Documentation (PDF)

http://www.psyop.tv/psyop-releases-jf-nested-dielectric-open-sourced-shader/

http://graphics.idav.ucdavis.edu/~bcbudge/deep/research/nested_dielectrics.pdf

  • Pingback: Tips for Rendering Refractive Surfaces with Arnold's Nested Dielectric Shader | LESTERBANKS

  • Azes Numbledas

    Hello

    How install this shaders in osx?

    • therenderblog

      Hey, I don’t use OSX so I can’t help you on that. But have a look here:

      https://github.com/Psyop/jf-nested-dielectric

      Make sure you are installing the right plugin for your MtoA/arnold core version. Also when you open maya have a look at the output window to see if you are getting any errors. Let me know. Cheers

      • Azes Numbledas

        aaaaargh! after several hours trying everything I’ve gotten it to work on osx … here you have me steps:

        1_ rename the extension of the binary file: jf_nested_dielectric.so to jf_nested_dielectric.dylib

        2_copiar jf_nested_dielectric.dylib and jf_nested_dielectric.mtd inside the “shaders” folder (in Mtoa)

        3_copiar jf_nested_dielectric.py in “scripts / Mtoa / ui / ae” (in Mtoa)

        I hope this help to others osx users!

        thank you very much for your blog, is very good!

        • Thomas

          hi, this isn’t working! i’ve dragged these files and still in the maya shaders area, they aren’t showing! help!

  • Jonathan Richter

    You’re getting some great variation, it seems, on the surface of the bottle. I’m trying to map an image to specular somehow to achieve something similar, but still haven’t gotten anything to show up. Is that the roughness at play there in your image, or have you found a way to map the specular? (great post! thanks!)

    • therenderblog

      Yes, I am mapping the specular roughness, a simple grungemap mixed with an aiNoise. Then to control the overall roughness connect a remapHSV in between and adjust the output levels.

  • Jonah Friedman

    Hey, nice tutorial! A minor correction: the more sensible and general case setup for the bottle tutorial is bottle = 0, liquid = 1. I go on about the way priorities work in depth in the documentation, but the short version is that lower numbers are higher priority, and objects with the higher priority will cut out objects with lower priorities.

    In your example, the space in question is the overlap- the space that’s occupied by both your bottle and your liquid. The way you have it set up it renders as if area is made of liquid. It doesn’t matter much in your example, but if that were something like a water drop modeled by having a sphere half sticking through the wall of the bottle, you’d want to make sure that the water there had a higher priority than the glass.

    One other suggestion- perhaps add a link to the official documentation. Even though it’s not in tutorial form I do go over lots of other features of the shader: https://github.com/Psyop/jf-nested-dielectric/raw/master/documentation/jf_nested_dielectric_manual.pdf

    • therenderblog

      Thanks a lot Jonah! For some reason I had the idea that there was no documentation and only found about that after writing the tutorial. So I was just playing with the shader til I get the look.I was aware of the medium priority “rule” but since it was colored glass and liquid, I went after the “look” of my reference. Thank you so much for your work. :)

      • Jonah Friedman

        No problem, thanks for creating the tutorial!

  • photons

    hello, can you walk me through the process of installing on windows maya 2014. the recent GitHub file has one binaries folder contains a dll where do i copy that … and do i need to install anything from source folder. … please let me know …

    • therenderblog

      The .dll and the .mtd in the shaders folder, and the python template in the ui/ae scripts folder. The attached image should help you on that.

      • photons

        thank you very much! Good help..

  • Henry Peters

    I generated some droplets on a object and i converted them to a mesh. But when i render i get a lot of noise in my droplets. Any suggestions, i tried already a lot of options…..

  • http://lancetheunissen.wix.com/free-lance Lance Theunissen

    Hi. Thanks for the tutorial.
    Im having a small issue, I’m getting very blurry reflections in my render, even when i crank my samples up (render settings) the reflections in my glass dont seem to change much, even upping the samples on my lights arent doing the trick. Any suggestions will be greatly appreciated.

    Thanks

    • therenderblog

      It could be the light source, in this example I use a very sharp HDRI. What value do you have in the specular roughness of the material? Increasing the samples will only reduce noise. If it’s for a still you may also try to change the AA filter or reduce the gaussian filter to 1.

      • http://lancetheunissen.wix.com/free-lance Lance Theunissen

        Thanks for the reply! I have a pretty decent HDRI and the samples on it are set to 8. There is no spec roughness, it gets better when i crank my rendering samples up, lowering the filter that much causes more noise than is needed then I would have to up my render samples to smooth it out again. Im still experimenting and the results arent that bad. Thanks for the suggestions, I will continue to play around and find something i like :) I attached an image to show what im talking about, i hope it views correctly.

        • http://lancetheunissen.wix.com/free-lance Lance Theunissen

          Thanks for your help earlier :) I appreciate it. I found a slight “hack” work around for the noise. I learned from alot of testing that it was infact in the refraction, i tried to combat this by bumping up the refraction sampling in the render settings to something ridiculous like 50 and it didnt change a thing. After much experimentation and testing i found that adding a tiny bit of roughness in the U (Refraction> Roughness U) something like 0.010 it took care of it completely in my case :) . Yes the refraction has an ever so slight blur (roughness duh) its really a minor price to pay. I’ve gotta say, I am really loving this shader XD thanks a mill.

  • therenderblog

    Hey Henry, sorry for the late reply.

    What method do you use to generate the droplets? Meshing particles can always be hard to deal with, you can try to add more subdivs. I remember using this script and it was giving good results:

    http://www.creativecrash.com/maya/script/water-drops

    • Henry Peters

      No problem, thanks for your reply. I used exactly that script. The mesh is not vibrating but i think it has something to do with the shader. When i render different passes i see a lot of noise in the refraction pass but when i turn this higher in the arnold settings noting happens. I can’t get a clean render. I will try adding more subdivs.

    • Henry Peters

      More Subdivs didn’t work. I now rendered just one sphere as a test(sphere with shader and lighting with highres-HDR). In the render i get also a lot off noise even with a high camera AA. I’m i overlooking something? Please help? Maybe you could set me a scene for example just one sphere with settings so that i get a clean render? I would appreciate that very much!

      • therenderblog

        Could it be “opaque” checkbox in the mesh, not enough refraction depth? Send me the scene file to my email and I will have a look.

  • NilsC

    Very nice tutorial – I have a very basic question though that´s ultimatley why I tried this shd in the first place; I need the refract to affect my alpha, I need refractive propagation. Or how does arnold work around this? Its a simple switch and/or render setting in MR and Vray. But in Arnold? Its a pretty basic thing, should be able to accomplish this? Thanks for any reply. /Nils

  • NilsC

    Thank for you a great tutorial – I have a quick question! Is it possible to get refractive alpha propagation through this shader or the standard one? Such as MR or Vray handles glass alpha´s? Im at a total loss. Please help! :)

  • http://www.frameworks.gr Georgios Papaioannou

    I keep getting this error:

    [MtoA] Error parsing AETemplate file jf_nested_dielectricTemplate

    Traceback (most recent call last):

    File “C:solidanglemtoadeploy2014scriptsmtoauiaeutils.py”, line 59, in loadAETemplates

    mod = __import__(modname, globals(), locals(), [], -1)

    File “C:solidanglemtoadeploy2014scriptsmtoauiaejf_nested_dielectricTemplate.py”, line 5

    ^

    SyntaxError: invalid syntax

  • Nope

    Could you give the scene so we could play with it

  • http://lancetheunissen.wix.com/free-lance Lance Theunissen

    I’m curious about something. Assuming one wants to create realistic glass (chips, scratches and other imperfections) would I be correct in saying that this shader could benefit from having a bump map/normal map feature?