KeyShot Forum

Technical discussions => General discussion => Topic started by: seank on October 28, 2010, 08:12:59 AM

Title: Glass/liquid adjacent surface issue
Post by: seank on October 28, 2010, 08:12:59 AM
Any ideas whats going on in the attached image?  This assembly was created in ProE and the interface between the glass and the liquid are bang on.  Tried it as the native ProE and Step (attached).  Tried it at different qualities - same issue.

Cheers, Sean

ProE WF5
KeyShot 2
Title: Re: Glass/liquid adjacent surface issue
Post by: Speedster on October 28, 2010, 08:33:06 AM
"Bang on" is the problem.  You need a tiny bit of space between the surfaces.  I SolidWorks I scale one component like 0.5%-1% as a simple way to do it.  .0005 may be just enough.
Bill G
Title: Re: Glass/liquid adjacent surface issue
Post by: KeyShot on October 28, 2010, 09:03:20 AM
The correct way of modeling this glass would be to use 3 parts (interfaces). The air-liquid interface, the glass-air interface, and then one surface that models that glass-liquid interface. For the glass-air interface you can use the liquid material, for the glass-air interface you can use the solid glass material, for the glass-liquid interface you should use the dielectric material with a setting for glass on one side and the liquid settings for the other side.

Take a look at the Wine_Glass.bip included in KeyShot 2.1. It shows this setup as well.

-- Henrik
Title: Re: Glass/liquid adjacent surface issue
Post by: KeyShot on October 28, 2010, 09:05:17 AM
I should add that having the liquid as a small container inside the glass with a small distance to the glass
will work, but the result will not be quite right as the light will pass from glass to air to liquid, which changes the amount of light reflected and transmitted.

-- Henrik
Title: Re: Glass/liquid adjacent surface issue
Post by: seank on October 29, 2010, 02:24:02 AM
Henrik,

Could you clarify your suggested method?

Are you suggesting 3 models - the liquid, the glass and then a thin part filling a gap between them between them?  Is the term 'interfaces' used in rendering?

I'm on 2.0 not 2.1, could you post the Wine_Glass.bip you mentioned?

Cheers, Sean
Title: Re: Glass/liquid adjacent surface issue
Post by: KeyShot on October 29, 2010, 09:01:28 AM
Hello Sean,

You can update to KeyShot 2.1 for free when you have KeyShot 2.0. All our KeyShot 2.x upgrades are free for
KeyShot 2.x users.

Regarding the glass then yes, the model should be made of 3 parts.

-- Henrik
Title: Re: Glass/liquid adjacent surface issue
Post by: guest84672 on October 29, 2010, 12:59:23 PM
Not 3 parts - 3 surfaces. I hope this makes it clearer.
Title: Re: Glass/liquid adjacent surface issue
Post by: seank on November 03, 2010, 07:07:52 AM
Finally got hold of the wineglass file mentioned and can see the interfaces as described by Henrik - still confused by the forms in the model - why does the glass surface include the liquid volume, why not just the glass surfaces? - I'm sure there's some good technical reasons.

Anyway, got an acceptable result by adding a small gap as suggested by Bill

Sean
Title: Re: Glass/liquid adjacent surface issue
Post by: Speedster on November 04, 2010, 04:29:51 PM
"Bang on"!  Now drop something in behind it (last image) and be prepared to have your socks knocked off!
Bill G
Title: Re: Glass/liquid adjacent surface issue
Post by: JeffM on November 04, 2010, 08:14:01 PM
That does look good, but it is still a bit off due to the small gap you had to create. The reason you need to set up this model like the wine glass is to be able to pull the refraction of the liquid inside the glass to the very edge of the outer glass surface. Being able to see the thickness of the glass surface like this is incorrect.

You can see this effect in this real photo:

(http://upload.wikimedia.org/wikipedia/commons/1/11/Glass-of-water.jpg)

If you have upgraded to KeyShot 2.1 you will have the wine glass file that we included with the installer. This file is already set up for proper "liquid-in-glass" rendering and it shows the important steps beyond just having 3 surfaces to represent the varying "interfaces" between liquid, air, and glass.

Splitting up the surfaces in this way is important because you need to set different "IOR" and "IOR out" settings for each of the surfaces.

The IOR is the index of refraction for the "inside" of the surface, and IOR out is for the "outside" of the surface.

So, looking at the wine glass bip file we do see that there are three surfaces. The outer most surfaces covers most of the glass itself and you'll find the material is a solid glass with an IOR of 1.5. This means the inside of the surface will refract light like glass since glass typically has an IOR of 1.5. The IOR out for this part would be just 1, since the outside of the surface should refract like air (no refraction) and air has an IOR of 1.

That's the easy surface, the next surface, the top of the liquid is similar. You need to have the inside of the surface represent the liquid and the outside should represent air. So, for the wine glass the top of the liquid has an IOR of 1.33 (the IOR of water) and an IOR out is 1 since it is, again, air.

The third surface, the "interface" of the liquid meeting the glass is the tricky one. On the inside of the surface you have the liquid, and the outside you have glass. So, for the wine glass you will see that this surface has an IOR of 1.33 since the liquid is on the inside, and an IOR out of 1.5 since glass is on the outside.

You can get even more complicated by applying the same technique to the color settings of the dielectric material to create proper colored liquid and colored glass renderings.

Here is my rendering of the wine glass that has these techniques applied, notice the accurate refraction of liquid within the glass. Just like the real photo above.

(http://www.keyshot.com/images/JeffM/RedWineSmall.jpg)
Title: Re: Glass/liquid adjacent surface issue
Post by: seank on November 05, 2010, 04:34:13 AM
Thanks for this full explaination Jeff - very useful, although......

I'm still confused on the inclusion of the liquid surface in the glass surfaces - surely this puts two refractive setting in the same place? - liquid/air in the liquid top surface interface and glass air in the glass interface.

Why isn't the glass surface simply open where the miniscus edge meets the glass?

Cheers, Sean

cdspk@lboro.ac.uk
Title: Re: Glass/liquid adjacent surface issue
Post by: m2tts on November 09, 2010, 07:42:16 PM
Quote from: seank on November 05, 2010, 04:34:13 AM
Why isn't the glass surface simply open where the miniscus edge meets the glass?

I think you might be confused and think the wine  glass is a solid model. The glass surface is "open" where the liquid is. The wine glass model is not a solid manifold glass holding a solid manifold liquid, but three open surface models:the glass, the liquid interface and the liquid top. The liquid material IS the interior surface of the glass (that would complete a solid manifold of the glass), and it's material represents the interface of glass and liquid.
Title: Re: Glass/liquid adjacent surface issue
Post by: seank on November 10, 2010, 12:31:11 AM
Cheers for the clarification, it's hard to see the surfaces from the .bip - in this image it does look as though the glass has a 'capping' surface to make it manifold - the upper portion of the glass is a different colour from the lower portion, I presume this is just where the glass turns back on itself over the lip and down to the miniscus.

Can .bip files be saved as stp, iges etc.?  There no option in KeyShot but maybe through Rhino or similiar?

Cheers, Sean
Title: Re: Glass/liquid adjacent surface issue
Post by: m2tts on November 10, 2010, 09:19:17 AM
Bip files are mesh data, not nurbs, so they cannot be saved as igs or step.
Title: Re: Glass/liquid adjacent surface issue
Post by: guest84672 on November 10, 2010, 01:18:03 PM
Also, KeyShot is rendering software, not a data translator.
Title: Re: Glass/liquid adjacent surface issue
Post by: chippwalters on November 10, 2010, 03:24:21 PM
QuoteAlso, KeyShot is rendering software, not a data translator.

Even so, other programs, namely the ones which are modelers, not data translators, provide models for KeyShot.

It would be most helpful to have a workflow which allowed models to move back and forth between modeling programs via some sort of standard output-- say OBJ.

There are many times AFTER a model is completely setup and preliminarily randered in KeyShot, when I'd like to be able to go back into my modeler, make a tweak or two and not have to import and setup the model from scratch. Especially where labels are concerned...
Title: Re: Glass/liquid adjacent surface issue
Post by: JeffM on November 10, 2010, 03:46:58 PM
Quote from: chippwalters on November 10, 2010, 03:24:21 PM
QuoteAlso, KeyShot is rendering software, not a data translator.

Even so, other programs, namely the ones which are modelers, not data translators, provide models for KeyShot.

It would be most helpful to have a workflow which allowed models to move back and forth between modeling programs via some sort of standard output-- say OBJ.

There are many times AFTER a model is completely setup and preliminarily randered in KeyShot, when I'd like to be able to go back into my modeler, make a tweak or two and not have to import and setup the model from scratch. Especially where labels are concerned...

You can avoid having to redo the texture and materials work in KeyShot after updating your model by reimporting it and selecting the "retain materials" option in the import menu. Enabling "same coordinates" in this menu will also make sure the model comes in in the same space. Leaving "merge with current scene" disabled will clear out the previously imported model and give you a fresh scene with your updated model.

I hope that works for you.