Author Topic: IOR guide  (Read 20187 times)

2012-11-27, 18:13:30

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13153
  • Marcin
    • View Profile
I was trying to create a _more or less_ realistic glass with liquid and ice cubes inside. At some point I realised I'm completely dumb when setting proper IOR for different surfaces. My worst problems are:

-Air bubbles inside ice cubes (visible from air). air -> ice -> air? (yellow arrow)

-The part of ice cube that is under the surface of liquid. (air -> liquid -> ice), what material should it have?? Ice or liquid? (red arrow)

-The liquid/glass surface. If we assume that IOR for glass=1,55 and for liquid=1,33 then if we are looking from air, at the liquid, through the glass, this IOR should be 1,55/1,33=~1,16. But what if we are looking from above the glass (pink arrow) so that rays travel like this: air (ior 1) -> liquid surface (ior 1,33) -> liquid/glass surface (NOT 1,16 this time and it's the same surface!)?

I couldn't find any sensible explanation of this on the web. Is there any simple way to do it as realistic as possible?
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2012-12-18, 09:58:08
Reply #1

Realish

  • Guest
I thought about this a lot myself.  To get it perfect I think there needs to be a special surface or material option in Corona made for when two clear surfaces with different ior interact.  Until then I do what I mention below.

I generally get good results by having a single layer of geometry where the to surfaces interact and making the ior of that geometry the ior of the substance more in the center.  In this case the orange juice ior should be used inside the glass, the ice cube inside the juice, and the air inside the cube.  There should also be no geometry inside the other.  That might have not sounded right so I will give an example.  In this case the surface of the orange juice should not be inside the cube at all.  There should be a cut made in the surface geometry of the juice where any cubes poke out so the surface perfectly touches the surface of the cube and does not go inside the cube at all.

I actually see a lot of people do this wrong and the results always come out looking not as real as they should.
Please post your revised results.  I'm really interested to see how your pic will change.
« Last Edit: 2012-12-18, 10:04:58 by Realish »

2012-12-18, 11:52:25
Reply #2

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13153
  • Marcin
    • View Profile
I think I've figured this myself. What you wrote is correct. Here are some images - the one with ice cube is so you can see that I cut holes in fluid surface matching the ice cube's shape. I can also upload the scene if you wish. It's 6mb so I would have to find a place to drop it.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2012-12-18, 13:22:11
Reply #3

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9048
  • Turning coffee to features since 2009
    • View Profile
It does not make sense to describe the scene with relative IORs (for example 1.55/1.33 = 1.16), because you still need absolute IORs of both materials to compute fresnel reflection. You should NEVER EVER set this relative value to any glass/water material. Corona handles the fractions automatically where media meet. However, I was never able to come with a scheme of how to guess which side of each polygon is inside/outside.  What I do now is in most parts OK, but breaks when light enters side of the glass, and exits via the water surface (and vice versa).

The only way I could do it 100% correctly (and consistently, which is important for bidirectional methods) is, if I would take the normals into account. That would of course mean, that you would have to model scenes with correct orientation of normals. Then the correct way of modelling water in glass would be to model the glass, detach polygons inside the glass, flip them, cap it, and assign the water material to it (this should actually give you good results even now).
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2012-12-18, 14:35:19
Reply #4

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13153
  • Marcin
    • View Profile
Corona handles the fractions automatically where media meet.
I don't get this. "Where media meet"? This would mean overlapping polygons or a little space between the two surfaces. Both methods produce very unnatural renders. There's no two-sided material for Corona yet, right?

Quote
The only way I could do it 100% correctly (and consistently, which is important for bidirectional methods) is, if I would take the normals into account. That would of course mean, that you would have to model scenes with correct orientation of normals. Then the correct way of modelling water in glass would be to model the glass, detach polygons inside the glass, flip them, cap it, and assign the water material to it (this should actually give you good results even now).
In current version of Corona, is there any difference between flipped and not flipped normals?
Rendering a glass of water with a material with IOR 1.33 applied to sides of the inside of the glass gives unnatural results.
« Last Edit: 2012-12-18, 15:04:21 by maru »
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2012-12-18, 15:44:16
Reply #5

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13153
  • Marcin
    • View Profile
0 - empty glass, whole object has a material with IOR value = 1,55
1 - glass with detached, capped polygons inside, the inside object has an IOR value of 1,33
2 - glass with detached, capped polygons inside, the inside object has two materials: IOR 1,33 for top, IOR of 1,16 for sides
3 - full glass geometry with an additional water object inside (overlapping faces)
4 - full glass geometry with an additional water object inside. The water object is a bit smaller than the inner part of the glass which creates a tiny distance between the two surfaces (used Push modifier).

+reference photos

Conclusion: version 1 is the most realistic and physically correct. I should always listen to Keymaster and stop being an asshole. Corona is awesome.

But really, I remember doing something like this in some other renderer and it was necessary to make a surface with IOR 1,16 and flip normals. I'm glad this works fine in Corona.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2012-12-18, 18:22:34
Reply #6

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9048
  • Turning coffee to features since 2009
    • View Profile
In current version of Corona, is there any difference between flipped and not flipped normals?
There is not, but maybe I'll add it sometimes (optional), because it is crucial for bidirectional path tracing
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2012-12-18, 23:03:40
Reply #7

Realish

  • Guest
Keymaster
How about a new material for the boundary of two other transparent materials that uses the normal direction?
I was thinking it could work like so
The material could be a node where the two inputs would be the part in the [].
Front of Normal  [Orange Juice] - -  [Glass] Back of Normal

2012-12-18, 23:31:55
Reply #8

tomasd

  • Active Users
  • **
  • Posts: 19
    • View Profile
If people are willing to model stuff like that, i.e., actually have a single polygon interface and specify what material is on each side of it, it would be the bestest way for all kinds of physically accurate renderers.

2012-12-18, 23:59:28
Reply #9

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9048
  • Turning coffee to features since 2009
    • View Profile
Keymaster
How about a new material for the boundary of two other transparent materials that uses the normal direction?
I was thinking it could work like so
The material could be a node where the two inputs would be the part in the [].
Front of Normal  [Orange Juice] - -  [Glass] Back of Normal
I can do that, but my understanding is, that nobody aint got no time for this
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)