Do raytracers keep track of the current IOR?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  11 November 2013
Do raytracers keep track of the current IOR?

I've been working with 3D graphics for nearly 15 years and whenever I find some time to mess with rendering I still struggle with the simple quest to render wine in a wine glass. I think what confuses me is that I don't fully understand what a ray-tracer does and doesn't track for each ray in a scene. I use to think that the current ior wasn't tracked. A ray would hit a surface and bend the ray as if the current IOR was 1.0. When the ray hit another surface it would again bend the ray as if it's current ior was 1.0. However, I eventually came to a conclusion that the current IOR is tracked. E.g. if the ray goes from 1.0 to 1.5, then hits a surface with an ior 1.3, it would then make and adjustment for 1.5 going to 1.3.

Then this morning my life was turned upside down again when I stumbled across the wine glass scenario in the 3Ds Max documentation. Half way down the page . They say you need to set the ior of the wine to 0.8 in order to simulate the ray going from 1.5 to 1.3. If that's the case then what they're suggesting is that the raytracer doesn't understand that the rays current value is 1.5. This idea of precalculating/determining what "interfaces" exist in a scene seems flawed if that really is the case. In a static scene it might make sense, but in a dynamic situation you can't predetermine what to surfaces will interact with one another.

Can anyone clear this up for me? Thanks!

  11 November 2013
The problem here is the precision of the render engine and models.

For light to enter from 1.0 to 1.5 is easy, but to then transition from 1.5 to 1.3 would require the two models to be perfectly in contact with each other, any gap or intersection create a situation where either the bend would go from 1.5 to 1.0 and then 1.0 to 1.3, or, it would go from 1.5 to 1.3 to 1.5 again an even worse result. Some render engines build in a special exception for this to work properly where your safe bet is to simply make sure the geometries do in fact intersect, and then the engine will have an exception to break its rules, and see that when it enters the 1.3 surface, it shouldn't bend again when hitting the intersected 1.5 side. Modo and C4D do this for sure, not sure what other render engines do.
Quote: "Until you do what you believe in, how do you know whether you believe in it or not?" -Leo Tolstoy
Kai Pedersen
  11 November 2013
All IORs are actually relative. When you say a material has an IOR of some number, that usually means the amount of refraction you get entering that surface from a vacuum or from plain air. It's not that the ray has a current value, it's that the refraction is what happens coming out of one medium and into another.

The listed IOR of air is just above 1, but if you had a bubble of air under water, you'd want the bubble boundary surface (where you enter the air from the water) to have an IOR of 1/1.333 = 0.75. Raytracers may be clever about reversing the refraction for back-faces where rays exit a surface, but otherwise when you put just a single surface between two areas it's up to you to describe the refraction you want at a surface in terms of the relationship between what medium rays are supposed to be leaving vs. what medium they are supposed to be entering. The raytracer only works with the surfaces, it doesn't know that different "volumes" are supposed to be filled with different things in this context.

There's an old tutorial, still on-line, that I think was the clearest explanation I've seen for this idea. he sets up separate surfaces for entry and exit refraction to go into a glass jar that's mostly full of honey, in and out of each medium.

Jeremy Birn
Author, Digital Lighting & Rendering, 3rd Edition

Last edited by jeremybirn : 11 November 2013 at 09:43 PM.
  11 November 2013
jeremybirn, thanks for the information. Thinking in terms of relative versus absolute does make more sense, but I'm still surprised by the answer. Specifying the relative ior doesn't allow for fluids to render properly when animated between surfaces, for example water surrounded by air then landing in a glass cup. I guess if you were really that concerned about the accuracy, then you could animate the IOR.

Hey LucentDreams, I appreciate the comment. It wasn't the modeling technique that confused me as much as why an IOR of 0.8, but it is interesting to know some renders try to handle that case.
  11 November 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:46 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.