Rendering Liquid in Glass
Liquid inside a glass is a very tricky subject and needs the scene to be modeled in a specific way that is compatible with Thea Engine and also make use of the Assign Container. In this article we will learn how to prepare both a simple and a more complex scene.
The correct way to model the object can be seen in image 1 and in more detail:
- Liquid surface – The liquid object needs to be split in two parts, the one that intersects with the glass surface (Liquid Body) and the surface of the liquid (Liquid Top).
- Glass Surface – We will need to remove all the geometry that intersects with the liquid. This is the blue outline in figure 2.
After creating and applying materials to the objects, the last thing that we need to do is to assign the Glass material as a container for the Liquid Body surface. To do that:
- Select the Liquid Body model.
- Right-Click on it and from the Assign Container menu, select the Glass material.
In this scene, we have a more complex setup and this is because the ice cubes are partly inside the liquid’s volume. This requires some extra steps that will be explained here.
The preparation of the scene is exactly the same as with the simple setup but with some modifications to the original models:
- Ice cubes
We will need to split the ice cubes geometry exactly where the liquid’s top surface intersects with them
- Liquid’s top surface
We will remove the area of intersection from the liquid’s top surface.
After these modifications, we can go on assigning materials to the objects in the scene and assign containers.
- Assign the Liquid material as a container to the part of the ice cubes that is positioned inside the liquid’s volume.
- Assign the Glass material to the liquid’s body.
Assigning a container can be done by right clicking on an object, select Assign Container from the popup menu and select the appropriate material.