View topic - Possible small request: allow glass IOR < 1

Possible small request: allow glass IOR < 1

Post here questions about using YafaRay materials, texturing and procedural models.

Possible small request: allow glass IOR < 1

Post Thu Apr 07, 2011 8:51 pm

I want to bring up a small point about how yafaray handles the classic "liquid in a glass cup" situation, like what is described in the documentation under the glass material section: ... rial#Glass

I think there is a flaw with the setup described in the documentation, for example if you want to add absorption to the liquid inside the glass then apparently the colored liquid renders incorrectly:


I think the problem is with the normals of the interface between the glass and the liquid, absorption doesn't seem to work correctly with the normals pointing inside the liquid. But if you just invert the normals then there is another problem:


As you can see, although the absorption looks right now the change also killed the caustics. The problem is the IOR of the interface between the glass and the liquid. In the documentation the IOR of the interface is calculated as IOR_glass/IOR_liquid, but if the normals are inverted then the ratio has to be inverted too, and taking for example the liquid being water then the IOR would be 1.33/1.55 = 0.86. The yafaray exporter interface doesn't allow IOR < 1, so to test this I exported to xml in blender 2.49 and manually changed the IOR value in the xml file, and this is the result:


So with this setup the absorption effect looks correct, and caustics are back. I just don't know if there is a way to do this without editing the xml file to use IOR values < 1. If there is a way please set me straight. I did find some confirmation though that the setup I used is valid, the link below advocates it for mentalray users: ... ricks.html
(scroll down a bit)

P.S. I was looking over the luxrender documentation to see how they handle this situation, and apparently lux calculates the interface IOR values internally, according to what is on this page: ... R_handling

Does anyone know how this works exactly? Do you just keep the glass mesh and the liquid mesh manifold with the appropriate IOR values, and then internally the renderer creates separate interface meshes with the correct IOR? Their documentation is a little vague in this area, but this sounds like a convenient system for users (but more work on the development end of things, which is why I didn't suggest it).
User avatar
Posts: 235
Joined: Tue Sep 16, 2008 7:00 pm

Re: Possible small request: allow glass IOR < 1

Post Thu Apr 07, 2011 9:15 pm

Good finding, I think you should add it to the blender 2.5 exporter thread, in the mailing list or in the bugtracker
User avatar
Posts: 3089
Joined: Tue Dec 20, 2005 10:39 am
Location: Spain

Re: Possible small request: allow glass IOR < 1

Post Sun May 06, 2012 2:05 pm

Good thinking, but the absorption still doesn't look right. The liquid should look darker where it's thicker from the POV but that's not the case with this render. At least I don't see it.
Posts: 18
Joined: Thu Apr 19, 2012 9:14 pm

Return to Materials and Texturing

Who is online

Users browsing this forum: No registered users and 1 guest