Liquid in a container

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
wasd
Posts: 319
Joined: Tue Apr 24, 2018 7:20 pm

Liquid in a container

Post by wasd »

I have a question about volumes. What if I have a translucent liquid in a translucent container, how geometry should be done?
For light travelling through this container and liquid it should be air -> glass -> liquid ->glass -> air transition, right?
I can't come up with geometry. What is right? What is wrong? That kind of thing.
  • Container's and liquid's polygons share the same place:
    exact_render.png
  • Polygons overlap (liquid made slightly bigger):
    overlap_render.png
  • Gap (liquid made slighly smaller):
    underlap_render.png
  • Liquid without container:
    nocup_render.png
  • Container without liquid:
    noliquid_render.png
CPU Bidir + Metropolis | Core i5-4570
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Liquid in a container

Post by B.Y.O.B. »

Overlap (liquid scaled up so it reaches into the glass mesh) is the correct method. But you have to set different priorities for the volumes:
If the liquid is slightly bigger than the glass, you should set the glass volume to a higher priority.
For example, liquid priority 0, glass priority 1.
In regions where volumes overlap, the volume with highest priority is chosen and replaces all other volumes.

example pictures in this post: viewtopic.php?f=2&t=474&p=4831#p4828
Harvester
Donor
Donor
Posts: 49
Joined: Thu Jan 25, 2018 8:06 pm

Re: Liquid in a container

Post by Harvester »

In effect, considering that we are talking about medium interfaces, at least in theory or that's what I understood about this, we should create a geometry that reflects these media interfaces, which is to model correctly the glass (without the liquid portion of the mesh), the liquid-to-glass mesh and medium interface, the air-to-liquid mesh and medium interface. Isn't it this the formally correct modeling solution, despite the other one which is based on compenetrating the solid by the liquid might work. Am I wrong?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Liquid in a container

Post by B.Y.O.B. »

That's the old way of doing it, yes.
You need three meshes with three materials there: air-glass, glass-fluid and fluid-air.

But it is more complex to model and less flexible if you need to make changes to the shapes.
Also it doesn't work with fluid simulations, whereas the priority system can handle them.
Harvester
Donor
Donor
Posts: 49
Joined: Thu Jan 25, 2018 8:06 pm

Re: Liquid in a container

Post by Harvester »

Understand, it works only for still images, and it is less flexible. Thank you.
Burk
Posts: 29
Joined: Wed Jun 06, 2018 5:58 pm
Location: Hamburg, Germany

Re: Liquid in a container

Post by Burk »

I have good experience with the method of keeping all parts in one mesh, i.e. to model the mesh for the container and add a mesh to the surface of the liquid.
The various parts of the mesh then receive materials that correspond to the respective optical interface. In the example of water and glass, the water surface gets a glass material with IOR = 1.333, the container surface that touches the air gets a glass material with IOR = 1.47 and the container surface that touches the water gets a glass material with IOR = 1.47 / 1.333.
It is important to make sure that the normals point away from the optically denser material.
The method of using overlapping materials is, to my knowledge, physically incorrect.
s.a. http://adaptivesamples.com/2013/10/19/fluid-in-a-glass
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Liquid in a container

Post by B.Y.O.B. »

Burk wrote: Sat Aug 04, 2018 8:52 pm and the container surface that touches the water gets a glass material with IOR = 1.47 / 1.333.
LuxCore does this computation for you if you specify interior/exterior volume correctly.
Burk wrote: Sat Aug 04, 2018 8:52 pm The method of using overlapping materials is, to my knowledge, physically incorrect.
Not if you use LuxCore Volumes with correct modeling, normals, priority and interior/exterior settings in the materials.
Note: I assume that you mean the same kind of "overlapping" like wasd, where the fluid mesh is scaled to be slightly larger, so it extends into the glass mesh.
If you mean that the surfaces share the same place, then yes, that's incorrect because it will cause Z-Fighting.
Burk
Posts: 29
Joined: Wed Jun 06, 2018 5:58 pm
Location: Hamburg, Germany

Re: Liquid in a container

Post by Burk »

B.Y.O.B. wrote: Sat Aug 04, 2018 11:59 pm Not if you use LuxCore Volumes with correct modeling, normals, priority and interior/exterior settings in the materials.
Yes I understand, Thank you.
I meant the overlapping like wasd, but did not consider the influence of "priority", which ensure physical correctness.
To be sure:
What are the correct settings for the overlapping design by example for water in glas surrounded by air:
  • normals all pointing outward
  • inside volume as in the materials and
  • outside volume for water and glas with IOR = 1.0?
User avatar
FarbigeWelt
Donor
Donor
Posts: 1046
Joined: Sun Jul 01, 2018 12:07 pm
Location: Switzerland
Contact:

Re: Liquid in a container

Post by FarbigeWelt »

Usually I create glasses using mesh spin. This tool is a bit tricky but leads to realistic shapes. This time I used a short cut. I created a glass from cylinder with boolean difference. After applying mesh smooth result got rather distored, see glass at the right.
Does anybody have an idea what is wrong with that glass?
3 Glasses with Liquid
3 Glasses with Liquid
Glass with Liquid.zip
Glass with Liquid
(200.63 KiB) Downloaded 219 times
Light and Word designing Creator - www.farbigewelt.ch - aka quantenkristall || #luxcorerender
MacBook Air with M1
wasd
Posts: 319
Joined: Tue Apr 24, 2018 7:20 pm

Re: Liquid in a container

Post by wasd »

FarbigeWelt wrote: Sun Aug 05, 2018 12:24 pm Usually I create glasses using mesh spin. This tool is a bit tricky but leads to realistic shapes. This time I used a short cut. I created a glass from cylinder with boolean difference. After applying mesh smooth result got rather distored, see glass at the right.
Does anybody have an idea what is wrong with that glass?
Using complex shape polygons, like those at rim on your glass is not good. Smoothing makes polygons weirdly shaped.
Also, bottom of the glass inside and outside is single polygon, so smoothing makes it spherical.
Attachments
2.png
Glass with Liquid-2.blend
(908.39 KiB) Downloaded 242 times
CPU Bidir + Metropolis | Core i5-4570
Post Reply