Page 1 of 2
Liquid in Glass
Posted: Mon Jan 13, 2014 5:22 am
by bograt
I was having a look back at this thread:
http://www.maxwellrender.com/forum/view ... r+in+glass
I was wondering, currently what is the best method for rendering liquid in a glass? and what would be the approach for putting air bubbles or dielectrics into the liquid?
Tom, I noticed you upload a nice render to the gallery some time ago. Did you use the technique mentioned in the thread I linked to?
Cheers,
Jules
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 9:52 am
by seghier
i ask about that in realflow facebook page but they don't reply
in maxwell this is the right method to create real effect

but what we do with complex shapes ? and when we use realflow ?
i tried render a demo scene ; liquid in glass but the result not good like in the realflow manual (with the same scene )
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 1:59 pm
by eric nixon
These two renders use the method in the diagram.
Transparent around an sss;
and SSS around a transparent; (only works in MW3);
To get the sss latte foam looking as though it was touching the glass, I cheated a little using a boolean cut to remove the glass surface at the foam edge.
what would be the approach for putting air bubbles or dielectrics into the liquid?
This is from another thread, a somewhat simplified diagram, but still informative;

Re: Liquid in Glass
Posted: Mon Jan 13, 2014 2:11 pm
by numerobis
wow!

very nice and clean renders. Is this using the 'liquid in glass" setup above or something different?
Would be nice to know the sl and render times...
edit : "These two renders use the method in the diagram."
ok, thanks
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 3:29 pm
by photomg1
agree with you numerobis ,
I wish someone would post an obj/fbx version of a model showing this working correctly , so we could all study it .I still have some issues with this and is one of the few things that really bugs me in maxwell.
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 4:20 pm
by bograt
Thanks Eric, They look great! I was hoping a new solution had been implemented into newer versions of Maxwell.
As discussed in the thread, the method seems to work but for complex models it is a frustrating workaround.
Thanks
Jules
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 5:27 pm
by hatts
photomg1 wrote:I wish someone would post an obj/fbx version of a model showing this working correctly , so we could all study it
Here you go. In the .ZIP you can find an MXS with the geometry, a textures folder, and an OBJ.
Quick render below shows the result.

Re: Liquid in Glass
Posted: Mon Jan 13, 2014 5:34 pm
by seghier
if we create animation of water in glass ?
we can't create new shapes for all frames
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 5:53 pm
by photomg1
Hatts,
massive thank you !! I really hope I can return your generosity at some point .
Best
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 6:02 pm
by eric nixon
That example file works ok, but it is missing 1 detail. If you look at the big diagram, the green line which is the glass geo that follows the top surface of the liquid, this should have a polygon selection applied to it with a duplicate of the glass mxm, the duplicate needs to have clear transparency AND no spec, because the spec reflection is provided by the liquid underneath.
Basically that top geo just needs the ND + attenuation of the glass (so that maxwell understands the light path) it doesnt need anything else. Actually I disagree slightly with the diagram because I think the top geo should always have roughness 0, not necessarily the roughness of the liquid (which also may be 0). Anyway thats what I've been doing. Maybe Tom can confirm this.
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 6:07 pm
by Mihai
I don't think that's needed Eric, as the diagram mentions - in that infinitesmal gap, it's as if the glass top surface isn't there. Try with just the same glass material surrounding the liquid - and yeah most likely you don't want to use any roughness on the liquid. I think Thomas was mentioning that in case you had a rough glass material. The liquid should always be rough 0 or it doesn't make sense.
So in the case of glass having some roughness, yes you would need a split surface there with roughness 0. Well, even if the glass has a rough 1 or so, I think it will still be fine and you don't need that separate green surface.
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 6:11 pm
by eric nixon
No that wont work, you want to see the spec of the liquid on top, which is already there by default, so you need to adjust the glass area on top, because otherwise you will get the extra spec that you dont want. Also that would slow it down slightly with the light bouncing between parallel surfaces.
EDIT: just realising I forgot something which makes the the 'ribena render' above invalid; The top surface which has no spec should have the roughness of the cup, I'll do a re-rendner now. hang on.
Thankyou Mihai, for making me think about this detail.
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 6:21 pm
by photomg1
Mihai and Eric , could you post a sample file of what you both mean ….. it would be fantastic for anyone new (or someone who finds it hard to get it to work like me

) to be able to download a mxs file like Hatts did . There really should be a definitive example version available to download from V3/V2 documents. As it is a common problem.
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 6:37 pm
by eric nixon
Erm, just found out something I didnt expect...
When the situation is a rough transparent cup, and therefore to get correct light path you need the green line as per the diagram. In this case the roughness prevents the liquid spec from showing, so the spec must be added to the green line geometry instead, and this requires two bsdf's in both the mxm's used for the cup. In my scene my cup mxm already had two bsdf's so it wasnt a problem, here is quick 10min test;
here is the packed scene, if it helps. I'm not sure the diagram is correct for every scenario.... I am a bit confused though,.. my head is a mess today..
It seems that if the spec needs always to be on the green line surface, then it should be muted slightly (using a 2nd mxm applied to poly-selection) because the glass cup will have too much spec compared to the liquid.
https://www.mediafire.com/?5nmsi25049tc5hh
Re: Liquid in Glass
Posted: Mon Jan 13, 2014 7:00 pm
by photomg1
Massive thanks to you as well Eric ! ,
I've been finding myself confused with this topic all along if its any consolation .

at least you and Hatts have been getting very good results …
when you say you are not sure that diagram is not correct for every situation , what are you thinking of ? because for me I always wondered when I look at it its going to create a crazy mesh on the glass object if it was an image of liquid being poured out of a bottle for example . I seem to remember simmsimaging doing some images like that in maxwell with success so its just me who needs to get his head around it .
Hatts that file is a massive help , I'm sure yours will be as well Eric when I check it out after I finish a render.