Jump to content

Rendering glass in mantra


Recommended Posts

Hello!

I have a few questions about rendering glass/refractive materials in mantra. I found more documentation for renderers like vray and arnold for getting good looking glass. Obviously the parameters are a bit different, but more or less they are very similar. Take a look at this photo about glass and vray from this articles: https://blog.turbosquid.com/2014/04/21/turbotips-v-ray-material-part-3-refraction/

vray.png.17c82f8e33bd46e9caf8297085b4ddcf.png

For purposes of testing, I decided to create a similar scene rather then in my main project. That way I can work in a simpler environment and also upload my .hip here. My first question are:

Many documentations/sites have the index of refraction (ior) for glass. The article above reads:
"IOR is a very important parameter to set correctly, in order for your material to look believable. Fortunately, these values have been calculated for all sorts of materials, so there’s no need to guess here."

It then states the ior of glass is around 1.5, which checks in with most other places. How can you just say the IOR of glass is 1.5? Wouldn't some glass have different IOR values? Especially if the glass is flat vs spherical or warped. If I try to match the ior values, it looks nothing like the vray photo. IOR of 1.5 is way too distorted to look correct. Please note that my sphere has an inside and a outside (thickness). I set the normals correctly. It seems having thickness to my sphere causes the ior to double. If I delete the inside of the sphere, it is less distorted. So I try setting the IOR to a lower value. However, once I do that, the reflection becomes too weak and super grainy. Mind my actual project is more complex and the reflections are soooooo grainy. Even with a pixel sample of 20 and turning up my light samples, its still too grainy and takes too long. So why can't I change the IOR for reflectivity separately from refraction? The manual says its not realistic, but its just not working for me when it is tied together. If you look at my photos below (you can make them bigger by clicking them) you can see that 1.5 distorts it too much. In my real scene, I have a snow globe. Whats in snow globe is distorted so badly with 1.5 you can't even see what it is. As I said, if I turn the refraction down to 1.1 or 1.2, I can barely see the reflections and they are SO GRAINY. I tried turning up pixel samples,  reflection/refraction quality, the sampling on the lights, but its still way too grainy. Any thoughts/tips? 

ior1.2.jpeg.3c9ee0a13e5ae238e74f73f3ca302724.jpegior1.5.jpeg.657b37f4ea94ed62dfd869e5b889822f.jpeg

glass_test.hiplc

Edited by ejr32123
Link to comment
Share on other sites

IOR is a fixed property of the material. It doesn't define the total visible distortion that you're going to see... obviously the curvature and thickness of the surface impacts how rays passing through it will end up oriented, but the number itself is just a factor of how quickly light can pass through that medium. Different types of glass will have slightly different IOR values, but a thin sheet of crown glass versus a thick sheet will still have the same IOR.

It's possible the thickness of your glass shell isn't realistic? Have you verified the actual thickness in mm? Typical snow globes are pretty fragile, the glass will be very thin, or else it will be made of plastic which has a different IOR. Also, it's important to remember that snow globes are filled with water, which has its own IOR (1.333), so you'd need to either include water geometry inside the globe with an IOR 1.333 material applied, or use a shader that supports an "inside IOR" and "outside IOR" such as the Classic Shader so that the light realistically will be refracted by both the glass and water mediums.

  • Like 1
Link to comment
Share on other sites

5 minutes ago, toadstorm said:

IOR is a fixed property of the material. It doesn't define the total visible distortion that you're going to see... obviously the curvature and thickness of the surface impacts how rays passing through it will end up oriented, but the number itself is just a factor of how quickly light can pass through that medium. Different types of glass will have slightly different IOR values, but a thin sheet of crown glass versus a thick sheet will still have the same IOR.

It's possible the thickness of your glass shell isn't realistic? Have you verified the actual thickness in mm? Typical snow globes are pretty fragile, the glass will be very thin, or else it will be made of plastic which has a different IOR. Also, it's important to remember that snow globes are filled with water, which has its own IOR (1.333), so you'd need to either include water geometry inside the globe with an IOR 1.333 material applied, or use a shader that supports an "inside IOR" and "outside IOR" such as the Classic Shader so that the light realistically will be refracted by both the glass and water mediums.

thanks for the reply, I will take a look at this..still not sure about the grainy reflections

Edited by ejr32123
Link to comment
Share on other sites

I meant to say there seems to be little refraction. You can look right through it just fine with out insane distortion. My sphere is super thin and the normals are correct but it displaces everything so much. if the refraction must be 1.4 what then can i change to have less distortion?

Edited by ejr32123
Link to comment
Share on other sites

I am confused, my geometry is exactly the same except I did a transform with slight scale and merged it back with the original. But mine looks way different. What is the difference between extruding 1 mm vs transforming 1mm and merging back together?

Link to comment
Share on other sites

4 minutes ago, toadstorm said:

The normals of the outer surface and inner surface have to be pointing away from each other.

I do, and it still looks different. I just multiplied the same normals by -1 to get them facing the opposite and it looks different

Edited by ejr32123
Link to comment
Share on other sites

It's possible that your winding order got reversed.

There's two things you need to check... one, the vertex normals have to be facing the right direction. The outer shell points outwards, and the inner shell points inwards. Two, your primitive normals need to be consistent with the vertex normal direction. Displaying the primitive normals in the viewport will give you a hint about your winding order. If they're not consistent with the vertex normals, you'd need to use a Reverse SOP to fix this, likely on the inner shell before you merge it.

  • Thanks 1
Link to comment
Share on other sites

5 minutes ago, toadstorm said:

It's possible that your winding order got reversed.

There's two things you need to check... one, the vertex normals have to be facing the right direction. The outer shell points outwards, and the inner shell points inwards. Two, your primitive normals need to be consistent with the vertex normal direction. Displaying the primitive normals in the viewport will give you a hint about your winding order. If they're not consistent with the vertex normals, you'd need to use a Reverse SOP to fix this, likely on the inner shell before you merge it.

Yes :) I needed to use a reverse. that was my problem. Thanks so much : )

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...