Page History
Overview
...
This article discusses how to use V-Ray for rendering refractive surfaces that are in contact. This is a typical scenario for scenes with liquids contained in glass or other transparent, or semi-transparent containers.
Here we examine some potential modelling mistakes and the correct workflow with V-Ray. For shading guides on how to create water material, or glass material, follow the links. We won't go into great detail about the shading process here, but offer some tips.
Additionally, we show a basic caustics effect workflow to complete the final image.
Scene Setup
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Geometry
This tutorial will help show you some techniques for rendering a liquid inside a glass.
...
...
Section | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Section | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Modelling Workflows
...
The issue with rendering two refractive surfaces in contact, is that we have two separate objects, which share the exact same surface boundary. From a modeling point of view, it is very difficult to ensure that the two objects have the exact same boundary geometry. While this can be achieved for static scenes, things may become very problematic in animation.
From a rendering point of view, if the two surfaces match exactly, the renderer cannot distinguish between them accurately, which may lead to errors in the rendering.
Considering these two issues, it is obvious that we need to separate the surfaces or to model the surface interface separately. We have the following
...
options:
Fancy Bullets | ||
---|---|---|
| ||
|
See the following images for the three main situations regarding the geometries positions - aligned geometries, geometries without intersection and geometries with intersection:
Section | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Section | ||||||||
---|---|---|---|---|---|---|---|---|
|
Tutorial Assets
To download the file used in this tutorial, please click on the button below. This scene was created in Maya 2016 and can be opened in that version or newer.
Part I: Initial Rendering
Open the starting scene, available from the assets section above.
In the Render Settings window, make sure that the Render Using drop-down is set to V-Ray.
Next, let's get some GI in the scene. In the Render Setting's GI tab, then under the GI rollout, turn On GI. Also, disable the Refractive Caustics setting. We will add photon-mapped caustics later for the final image.
Render the scene (). The V-Ray render should look something like this:
This shows the container that we will fill with liquid in the next section.
Part II: Rendering the Liquid
Now let's add liquid inside the glass:
Using the Outliner, un-hide the liquidInsideGeo object (by pressing Shift+H). If you look at the scene through the Front or Side viewports (shown below), you'll notice that the liquid object is slightly set inside the glass container, without touching it. With the liquid object now visible, render a frame to see an image like the render below.
Section | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Although the distance between the container and the liquid is really small, the rendering does not look realistic, particularly at the bottom of the glass - it looks like a glass with a solid glass block inside it. To avoid this, let's make the liquid overlap the glass a little bit. Luckily, that is already done for you:
Hide the liquidInsideGeo object (Ctrl+H) and unhide the overlappedLiquidGeo object (Shift+H).
Using the Front or Side viewports, you should notice that this liquid object overlaps the inside of the glass object a little bit:
Render the scene again and the glass with the overlapped liquid object looks like this:
...
Now it looks better; the liquid really seems to be touching the glass.
Part III: Final Rendering
For the final rendering we would like to improve the antialiasing, get rid of any noise and to add some caustics for a better, final look.
Turn Caustics on from the Caustics rollout at the bottom of the GI tab of the Render Settings. Leave the attributes at their defaults and render a frame to see the result below:
Some caustics appear on the ground plane in front of the glass and are somewhat blotchy. Furthermore, no caustics seem to be going through the glass. In the Hypershade, select the glassMtl and in the Refraction rollout, turn off Affect Shadows. Affect Shadows is good for transparent objects casting proper shadows but doesn't allow for proper refractive caustics using photons. Select the waterMtl and turn off Affect Shadows as well (shown below) for the liquid inside the glass
Now render the frame:
Set the Max. density to 0.2. This provides a little bit of a smoothing effect. Define a region at the bottom of the glass as shown below, and render that region to see the caustics now.
The caustic effect looks smoother than before, but perhaps a bit strong going through the glass. Set the Multiplier to 0.8 and render to knock it back just a little bit:
The Caustics settings in the Render Settings window, GI tab currently look like this:
Turn off Region Render and render a full frame, and it should look like this:
Caustics look better now and these are the settings to use for the final rendering. If you want even smoother caustics, further increase the Max Photons parameter. For more on rendering caustics, click here.
Optional: Saving Caustics Calculations
In order to avoid recalculating the caustics every time for the further renderings, use the Save button under the Caustics Mode to create a .vrpmap file, then set the Mode type to From file, so the Browse button becomes available to choose the file you just created.
Increase Anti-Aliasing Quality
Now we need to improve the antialiasing and to reduce the noise from the area lights.
Go to the VRay tab and in the Image sampler rollout, set the Sampler type to Bucket. Then from the Buckets subsection, set the Threshold to 0.005.
The final render should look like this:
Alternative Rendering Approach
Another way to render the image is to use the Progressive image sampler in V-Ray.
4.1. Turn off the photon-mapped caustics;
4.2. Set the primary and secondary GI engines to Brute force;
4.3. Turn on the Refractive caustics option that we disabled before;
4.4. Set the image sampler type to Progressive;
|
As shown in the renders, the two approaches with aligned boundaries and the gap between the surfaces, render artifacts. For proper appearance in terms of reflections and refractions, position the geometries so that they intersect each other and avoid coplanar faces. This prevents from artifacts in the rendered image.
Shading
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Bonus: Caustics
...
Section | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Section | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
UI Text Box | ||
---|---|---|
| ||
Note that the Progressive caustics are still WIP and might not be suitable for all scenes. For more information, see the Caustics page for their known advantages and limitations |
...
. |