This is RenderMan 21 Documentation you are viewing. The Rmanwiki home page will redirect you to the current documentation.
When rendering refractive objects, it's important to pay attention to the interface (where objects meet). Poor settings may show artifacts like air gaps, incorrect coloring, or have wrong results when using caustics. Times to consider this workflow are when you are rendering things like liquids in glass, air bubbles in champagne or ice, or complex fluid simulations.
Typically users model such things by creating a boolean operation so that these surfaces never really touch one another, it's either/or and not both at the same time. This can be complicated to setup and nearly impossible when trying to use a simulation like flowing water to do this effect. So in RenderMan you can add an attribute to the shape called Intersection Priority. It's a simple number to specify priority where lower numbers are higher priority.
You can find the paper for this topic here:
- Charles M Schmidt, Brian Budge. Simple Nested Dielectrics in Ray Traced Images, 2002
In addition we add an attribute for Refractive Index and match this with the material settings for IOR.
Below are a few examples of different solutions.
To better understand the liquid placement, below are the possible options shown in a cross section of the glass.
- Coincident - This is where the surfaces perfectly meet. Notice the noisy artifacts where shading points fight one another in the same position.
- Shrink - This example slightly shrinks the liquid inside the glass but creates air gaps.
- Intersecting/Overlapping - This is the best placement to avoid problems but needs a better hint to the renderer that they have different priority.
RenderMan intersection priority and IOR assumes models are built volumetrically (no two-dimensional objects) with outward facing normals.
In the above examples, the overlapping liquid and glass is most similar to the correct method which uses overlapping but adds the Intersection Priority to the glass and liquid shapes. Notice the change in color for the liquid and how much better it captures the light and refractions. The glass has an Intersection Priority of 1 while the liquid is 2. If we were to add ice cubes those would be 3.
In addition you should add the Refractive Index attribute and match this value with the material settings. The glass is 1.5 and the liquid is 1.33. Failing to set these may cause the render to be incorrect. Adding both parameters will also increase the accuracy of caustic light patterns when using the PxrVCM/PxrUPBP integrators with Trace Light Paths enabled in at least one light.
In some cases you may experience a small dark line where the geometry overlaps. To solve this you can create a Trace Bias attribute on the glass shape. By default this value is 0.0001 but can be increased in very small increments until the artifact is gone. Note that the attribute for Trace Auto Bias must be added to the object and turned off for manual trace bias settings to work unless the global setting for Trace Auto Bias is already off.
The glass scene is courtesy of Julien Duval.