Displacement mapping displaces geometry primitives along surface normals from a texture used as input. To perform displacement mapping, Clarisse needs to tessellate underlying geometries to create a displacement mesh. The displacement map texture is then evaluated on each vertex of this new geometry.
Please note that, displacements work directly on triangles and quads. However, if a polygon has more than 4 vertices, the polygon will be triangulated before being tessellated and displaced.
To enable displacement mapping you need to assign a displacement shader to a geometry shading group, using the Material Linker.
A displaced implicit sphere using Adaptive (base) heuristic
Even if displacements are extremely optimized in Clarisse, they both have a non negligible rendering and memory cost.
Displacement Mapping does not take account of the geometry position. In other words, it does not update properly if a displacement texture is set to World Coordinates.
Displacement is performed using Displacement shaders. Similarly to materials, you need to use the Material Linker to assign displacements geometry's shading groups.
Clarisse provides different displacement modes. You can set the displacement mode using the Mode attribute. While using a double sided mode, Front and Back Offset allow you to adjust the position of each side of the displacement.
|Front Only||The displacement is performed on a single side of the face. This is the default value.|
|Symmetric||The displacement is performed on both sides of the face. Both faces are displaced the same way but symmetrically.|
|Asymmetric||The displacement is performed on both sides of the face. Each face is displaced independently.|
Displacement Value is multiplied to the value of the displacement texture. Vertices are then displaced along their normals using texture values. Please note, displacement Value should be ideally relatively small when compared to the geometry size.
It has an overhead on both rendering and memory and the bigger the displacement value the higher its overhead is.
Displacement Bound controls the bound of the displacement map. The bound should be carefully set to maximum extension of the displacement texture.
A too low value will introduce clipping, whereas a too high value may slowdown considerably render times.
A wrong bound value that is too small introduces clipping and render artifacts
A poorly set bound value can lead to unpredictable results.
Clarisse provides different modes of displacement direction. You can independently set the direction of the displacement for each side of the geometry using both Front Direction and Back Direction attributes.
|Normal||The displacement is performed along the normal. This is the default value.|
|Vector (Tangent Space)||The displacement is performed in XYZ using a texture defined in tangent space.|
|Vector (Object Space)||The displacement is performed in XYZ using a texture defined in object space.|
Vector displacement uses slightly more memory than Normal displacement since the displacement has to store the positions of displaced vertices.
It is possible to control the way displacements are computed at the geometry level using the attribute Displacement Mode defined in geometries. There are 3 different modes available:
|Bump only||When set to Bump only, Clarisse skips the geometry tessellation and vertex displacements. The displacement shader is considered as a simple bump affecting only the shading normal.|
|Tessellation only||When set to Tessellation only, Clarisse tessellates and displaces the geometry according to the displacement shader. However the geometry normal returns the smoothed normals of the underlying micropolygon mesh.|
|Tessellation with Bump||When set to the default value Tessellation with Bump, Clarisse tessellates and displaces the geometry according to the displacement shader. The geometry normal returns the result of the bump normal which gives finer details. This mode is more expensive to compute since it requires additional computations.|
Displacement Tessellation Mode#
Clarisse provides several tessellation modes to drive tessellation schemes and thus level of detail of displacement. These attributes are defined in geometries.
|Adaptive (base)||This special heuristic performs adaptive tessellation based on primitive areas of the base geometry (without deformation). The level of tessellation is defined by Displacement Adaptive Span Count attribute.|
|Adaptive (deformed)||This special heuristic performs adaptive tessellation based on primitive areas of the deformed geometries. The level of tessellation is defined by Displacement Adaptive Span Count attribute.|
|Uniform||Perform uniform non-adpative tessellation. Each quad of the displacement mesh is subdivided by Displacement Uniform Span Count . For example a level of 2 subdivides a quad into 4 new quads.|
When using adaptive modes, the level of tessellation is defined by Displacement Adaptive Span Count. This value is relative to the max extent of the bounding box of the geometry that is displaced. The best way to understand how this heuristic works is to imagine you are subdividing the bounding box of the underlying geometry instead.
In fact when you set a value of 200 spans, this defines the size of the micropolygon according to the bounding box size. The geometry is subdivided adaptively using this micropolygon size.
The mode doesn't add micropolygon to primitives for which the area is smaller than the micropolygon size. As a result, the tessellation tends to become more homogenous.
Adaptive tessellation (500). Note the homogeneous tessellation
When using the uniform mode, the level of tessellation is defined by Displacement Uniform Span Count. This value controls the number of subdivisions for each primitive whatever their size/area. When you set a value of 10, each edge of the primitive is subdivided into 10 spans. As a result, small primitives are tessellated the same way larger ones are.
Uniform tessellation (5). Note the heterogeneous tessellation.
Adaptive vs Uniform#
As a general rule, it is best to use Adaptive tessellation for hero assets since it ensures primitives are subdivided only when needed resulting in a nice homogeneous tessellation. Uniform tessellation, on the other hand, results in heterogeneous subdivisions which isn't ideal for such assets.
Homogeneous tessellation with adaptive tessellation
Heterogeneous tessellation with Uniform tessellation
However, since Clarisse doesn't support camera-based adaptive tessellation, it is very inefficient to use adaptive tessellation on geometries defining large area of waters (oceans) or terrains where you'd typically like more details closer to the camera.
In that case, it is way more efficient to use uniform tessellation on a geometry that takes into account distance-based subdivision.
Example of a geometry that is tessellated more in the center than on its boundaries
Using uniform tessellation, there's more details in front of the viewpoint
When using this geometry in Uniform tessellation, areas of the geometry that are closer to the viewpoint (positioned at the center) have a lot more subdivisions and more details than areas further away.
Using Adaptive tessellation here is extremely inefficient because areas further away becomes overly tessellated while the ones closer to the viewpoint are under tessellated.
As you can see in the renders below the Adaptive tessellation one lacks details closer to the viewpoint but also the background is overly tessellated when compared to the Uniform one!
This attribute allows you to perform geometric stitching between primitives of a displaced geometry. This is useful when the texture used to displace the geometry is not perfectly mapped on the object and that discontinuities are present between primitives.
Stitching is only modifying displacement values so, if normals are not continuous between two neighbor primitives, cracks will still appear. In order to work, Displacement Storage Mode need be set to Favor Speed.
Indeed, stitching relies on two things: normal continuities and storage of displaced positions. When set to Favor Memory, the displaced positions not been available, Clarisse can't properly perform stitching.
|None||No stitching is done.|
|Shared Displacements||Stitching is done only between primitives sharing the same displacement node.|
|All||Stitching is done between all primitives if possible.|
When selecting the All mode, stitching can be done only between displacements of the same type. For instance, stitching can not be operated between a normal displacement and a vector displacement.
If you set Smoothing Angle to 180°, stitching is automatically performed even in Favor Memory since normals are continuous across edges.
The way displacements are computed and stored in memory can be controlled via the Displacement Storage Mode attribute. By default Displacement Storage Mode is set to Use Preferences. This means, the displacements uses the mode set in the Preferences. You can change globally this setting at the application or the project level.
To do so, go to Edit > Preferences...> Rendering and change the Displacement Storage Mode. Alternatively you can change this setting for each geometry by modifying locally their Displacement Storage Mode attribute.
- When in Favor Memory (by default) displacements uses less memory at the expense of the rendering speed. In this mode displacements computation is roughly two times slower than when set in Favor Speed.
- When Favor Speed, Clarisse will use more memory but displacements will be twice as fast to render. The memory usage is directly proportional to the number of properties and the number of time samples (for deformation motion blur) the geometry has.