Blender 2.79 | Cycles Renderer
When it comes to rendering nested refractive volumes, like a glass containing a beverage, the way to set it up in Cycles is common to many modern ray-tracers.
The touching bodies of refractive material like glass and liquid must overlap each other slightly so that rays being traced “meet” the right surface without having surfaces touching and causing “Z fighting” artifacts.
When the render includes volumetric shading, like Volume Absorption (sometimes referred to as “fog”), the meshes must be set-up in a certain way for Cycles to interpret the volumes properly.
Intersecting volumes like a beverage glass and liquid must be separate objects to be rendered correctly. When joined into one mesh the renderer doesn’t treat the different volumes separately even though they have different shaders.
And the result is that the volume (depth) of the inner volume is calculated as just the depth on the intersection (the overlap) of the volumes.
In this example the wine can’t be rendered correctly when the glass and liquid meshes are joined.
The wine liquid doesn’t get it’s deep color because the renderer “thinks” it’s very thin.
When the meshes are separated the renderer interprets the wines volume correctly and the Volume Absorption shader produces the right color:
Setting up cavities within a volume like air bubbles, is similar to many other modern ray-tracers. You just have to create inner meshes that have flipped normals facing inwards, so air bubbles within the wine don’t need to have “air” material, they have the same wine shader, but have their faces flipped.
Note that in this case, it’s the other way around from the previous example.
If the bubble meshes are separate from the liquid mesh the renderer doesn’t interpret them as holes in the liquid volume, and produces an incorrect result:
When the bubble meshes are joined to the liquid mesh, the volume is interpreted correctly:
For these refractive volumetric effects to be rendered correctly in Cycles,
Surfaces of the same material volume must be joined to one mesh, and separated from meshes belonging to different material volumes.
* This may sound trivial, but it’s not. there are rendering systems in which only the surface shader determines volume interpretation and that has advantages like the convenience to aninate bubbles as separate objects from the liquid itself or the ability to join a glass bottle with the liquid into one mesh model.