A scene volume is defined by an enclosing geometry. It must be perfectly sealed, some CAD tools such as Rhinoceros have tools for checking this.
Surface normals must all point to the outside of the volume. Use tools such as "Unify normals" and "Flip" normals in your modeling software for this.
An exception to the previous rule exists : you may create holes in the volume by adding other shapes inside with normals oriented inwards. These bubbles must not intersect with the outer geometry.
To associate a medium with the geometry, first create a material, and use the medium as the "bulk" child medium. This special medium will propagate to the scene and fill the volumes of geometries to which the material is applied.
What happens if two geometries with bulk media overlap?
- If they share the same medium (because they share the material, or via a linked medium), the overlapping space is properly filled with the corresponding medium as well
- If they have different media, Ocean will take the medium having the highest precedence. If precedences are equal, it chooses an arbitrary one.
Taking advantage of overlapping : the drink example
Let us consider the following case : modelling a glass of whisky. Two volumes with media are to be considered : the glass material itself, and the whisky.
The intuitive way of modelling this would be by having both geometries (glass and whisky) touching where glass and liquid are in contact. However, due to numerical imprecisions, they may be seen as slightly separated by the raytracer. This will result in a thin air gap inserted between glass and whisky, which will lead to wrong optical properties. Moreover, this will happen randomly with numerical errors, causing the result to be full of artifacts.
To achieve a perfect result, it is more simple to overlap the whisky geometry inside the glass, and set a higher precedence to the glass.
Overlapping and precedence may be used to create holes : defining a medium with air properties (n=1) and applying it to overlapping geometries will create holes or bubbles.