Displacement component
Image courtesy of Meindbender
Displacement is a powerful texture-driven tool that can help users to create real geometric detail on objects. Contrary to bump/normal maps, the displacement feature simulates real geometry at render time as if it was actually modeled. This feature is very useful for adding fine detail to a mesh which would otherwise be difficult or impossible to actually model. Displacement uses a texture to define the geometric detail.
Displacement methods - On the fly vs Pretesselated
Maxwell Render has two methods of displacement:
On the Fly
This method is Maxwell Renders unique displacement technology allows you to create virtually unlimited detail while using very little extra memory. This is it's main advantage but it will take longer to render especially for bigger displacements. This method is recommended for very fine, smaller/medium displacements.
Example of very fine displacement using On the Fly displacement method
Pretesselated
Using this method, Maxwell Render will tesselate the geometry before starting the render, creating real triangles in memory. This method has two main advantages: it renders much faster than On the Fly and can also render vector displacement maps. The only limit of detail is how much RAM your system has, as all the geometry needs to be in memory at render time.
Example of a vector displacement map (middle) applied to a simple plane. Vector displacement can specify direction in all three axis (not just up/down like regular displacement)
Vector displacement maps can be created in 3D sculpting applications such as Mudbox or 3DCoat.
Adding displacement to a material
A displacement component can be added to the material (only one component per layer is allowed) by right-clicking in the Layers list area of the Material editor, or from the Edit menu of the Material Editor. Please note that, although you can have several displacement components in a material, only one of them will be selected for rendering. You can specify which one you would like to use by clicking on the Material Properties row in the Layers list. It can be useful to have several Displacement components in one material for quickly switching between different sets of displacement settings.
To use displacement, you need an object with UVs, and a displacement texture. The texture is similar to a usual grayscale bump map, with different shades of gray to describe elevation levels. Lighter grays will raise the geometry and darker grays will create cavities. Vector displacement maps are in color and 32bits, Red Green Blue describing both elevation and direction.
Displacement parameters
Displacement Map
You must first load a displacement texture to access the displacement parameters. Maxwell Render can use 8, 16 or 32-bit grayscale displacement maps. It is recommended to use at least a 16-bit displacement image to create a smooth displacement, because 8-bit images may not contain enough gray levels (they only contain 256). You may see a stair-stepping effect if using 8-bit maps. 8-bit maps may be enough for displacements that do not require smooth transitions between grey levels, and additionally Maxwell Render’s texture interpolation helps to render even 8-bit images smoothly.
Vector displacement requires 32bit displacement maps
Height
This parameter sets the maximum distance displaced. It tells the engine how much real geometric height you want to displace on your base mesh. This value needs to be greater or less than zero for displacement to appear. The white of your texture will be raised to the height value you set. Displacement height can be set in percentages or in absolute units:
- Percentage (%): Set the desired height as a percentage of the longest edge of the associated object’s bounding box. For example, if you have a car of 300 x 150 x 110 cm and you set height as 1, this means the peak displacement will be 1% of 300 (the longest edge of the bounding box) which is 3 cm to be observed as real length in render output. Using relative height is useful when you wish to preserve the same displacement height when scaling the object.
- Centimeters (cm): Set the height in centimeters to always displace to this given value regardless of object dimensions.
This parameter is disabled when using vector displacement, because the height values are derived from the map pixels values. Instead it is the Scale parameter that controls the overall size of the displacement in X,Y,Z directions.
Offset
This parameter allows you to specify which gray level in the texture should represent zero displacement. It is important that you set this parameter correctly, based on what type of displacement map you use. For example, some displacement maps may use 50% gray as zero displacement (darker shades than 50% in the texture will create cavities, lighter than 50% will raise the geometry). In this case, you should set the Offset parameter to 0.5 to get a proper displacement. If your displacement map uses black to represent zero displacement, set Offset to 0.
This parameter is disabled when using vector displacement.
Subdivision
Subdivision defines surface accuracy, ability and response to detail, independent of texture resolution. Before the surface is displaced, it is recursively subdivided, and this parameter is the measure of that subdivision level of the mesh: the higher the Subdivision value, the more accurate the result. However the more the mesh is subdivided during render time, the more it will influence the render time (although height has the most negative impact on render time), or, in the case of vector displacement it will use more RAM. Subdivision has no negative effect on render time when using the Pretesselated method.
Subdivision and texture resolution are strongly related:
- When specifying a low Subdivision value and using a high resolution texture with lots of detail, the final image will not show more detail than what is allowed by the Subdivision value.
- When specifying a high Subdivision value but using a low resolution texture, the subdivision will reach the limit of the pixel detail of the texture and will not show a more detailed displacement. The displacement will reach the detail level of the texture. This is important to understand because you can optimize the displacement by starting with a high resolution texture and lower subdivision value, and keep raising the Subdivision value until the detail in the displacement is satisfactory.
An example of how surface detail is affected by increasing the Subdivision for the same texture can be seen below:
Different Subdivision values to control the subdivision of the mesh
This example shows that going beyond a gain of 32 (in this particular case) would not add more detail while it would only increase the render time. So it is important to avoid unnecessarily excessive Subdivision values. This depends ofcourse on the resolution of your displacement map. A higher resolution displacement map will allow for more detail to be "extracted" from it.
Because the On the Fly and Pretesselated methods have a completely different approach to subdividing the geometry, the final subdivision in the render is slightly different but for most displacements, the difference is that On the Fly subdivision = Pretesselated + 1 subdivision
Adaptive
The adaptive option locks the subdivision value to the given texture detail (at half pixel accuracy), which has the advantage of always creating the most detailed displacement that a given texture can provide. The user does not have to guess what the maximum subdivision value should be for that texture, or worry about exceeding it (which would increase render times but would not necessarily increase image detail, see example above). The adaptive mode should be used with care, because using a very large-resolution texture to represent some simple detail will result in unnecessarily long render times.
The larger your texture, the longer the render times with Adaptive mode on because it will always render the maximum amount of detail for that particular texture. This parameter is not relevant when using the Pretesselated method.
Adaptive mode can add substantially to the render time, especially with big displacement textures. This mode should be used mainly to “test” your displacement textures first to see how much detail can be obtained from a given texture size. Then you can switch Adaptive off and manually raise the Subdivision value until a level of detail close to Adaptive mode is reached.
Smoothing
Similar to the object’s smoothing angle setting, this parameter controls whether the displaced surface should render smoothly (continuous shading) or render faceted. It is generally suggested you leave this setting to “on”, unless you aim to render very sharp, detailed displacements such as sharp corners. Please note that the objects smoothing angle will still override the smoothing used for the object’s base mesh faces, so if the object’s smoothing angle is set to Flat (rendering the object faceted), and the smoothing parameter is set to “on” in the displacement parameters, a smooth displacement surface will be rendered over a faceted base mesh surface.
Scale
This parameter is used only for vector displacement. It is used to control the overall size of the displacement (in X,Y,Z) and needs to be adjusted (usually lower than 1.0) when using vector displacement maps saved in absolute tangent mode. When using vector displacement maps saved in relative tangent mode, the scale parameter can be left at 1.0.
Tips for using displacement
Tips to reduce the impact on render times:
Render times can vary greatly. These three factors play an important role in render times:
- The base mesh vs. subdivision value (see below for details).
- The height of displacement (higher displacements will increase render times).
- For the On the Fly displacement method: How many displaced surfaces and objects the rendered image contains. For example, a common usage of displacement may be for a brick wall seen from far away, taking up 30-40% of the rendered image. In this case, low height and subdivision values can be used, and the impact on render times will be minimal. On the other hand, a close-up render of a displacement object taking up the whole image, using high subdivision values, will need more time to render clean.
Base Mesh vs. Subdivision
The more polygons you have in your base mesh, the less subdivision you will need to render the same amount of displacement detail. Displacements with less subdivisions will always render faster. For example, if you are planning to render displacement over a plane, model your initial plane using more than 2 triangles. The render time will not increase if your base mesh has many polygons.
Appropriate base mesh geometry
Objects made of evenly distributed polygons are preferable because they provide better quality. You should avoid base geometry with disproportionate triangles that converge to the same point. In areas with many small, converging triangles you may get artifacts when using displacement. This geometry is usually found in polygonal objects tesselated from NURBS geometry used in CAD applications. It is recommended to introduce more iso lines on the initial NURBS geometry in these areas to create more evenly sized polygons. Some CAD applications allow good control over the tesselation, offering the creation of quads instead of triangles, or a limit to how long a triangle can be in the conversion.
Rendering sharp details
To render sharp details, consider turning off texture filtering. It will help you render sharper high-contrast areas in your texture. If you are using a moderate subdivision value, displacement will slightly smooth the rendered detail. In this case you should turn off Smoothing under the displacement options to render the details sharper. Keep in mind that turning off texture interpolation might reveal a stair-stepping effect if using 8-bit maps with smooth gradients.
Object Smoothing Angle
To avoid any possible artifacts or gaps in the displacement on objects which contain polygons connected at sharp angles, make sure you set an object smoothing angle that exceeds the maximum polygon angle of the object (i.e. for a cube, it should be 90 or greater).
Overview of displacement types
Type | Description | Map example | Result |
---|---|---|---|
On the Fly | 1D height map displacement. The mesh is subdivided and the local Y coordinate of each point is vertically displaced according to the values of a greyscale map. The object mesh is subdivided and displaced at render time, so the consumption of RAM is lower. Use this option when you need to prioritize the RAM consumption of your system. | ||
Pretesselated | 1D height map displacement. The mesh is subdivided and the local Y coordinate of each point is vertically displaced according to the values of a greyscale map. The object mesh is subdivided and displaced before the voxelization, as a pre-process, so the pre-process and voxelization takes a bit longer, but as soon as the whole geometry is loaded into memory, the render is then much faster than On the Fly displacement. | ||
3D relative tangent (zero black: Mudbox style, zero grey: 3DCoat style) | "Vector" displacement. The mesh is subdivided and the X, Y and Z coordinates of each point are displaced according to the values of an RGB map. This displacement type works with the pretesselated displacement method. Using zero black or zero grey depends on the how the vector displacement map was created. Some applications use black to define zero displacement, others use grey. To have the same scale of displacement relative to the geometry it was sculpted on, you should leave the Scale parameter at 1.0. | ||
3D absolute tangent | "Vector" displacement. The difference between these kinds of maps and relative tangent ones is that the displacement height and direction, the vectors, have been hard coded to absolute values. Their final scale in Maxwell will depend on what scale you sculpted the maps in your sculpting application. For example if you sculpted the map on an object several meters in size but you apply it to an object a few centimeters in size in Maxwell, the displacement will be much too large. You can use the Scale factor to lower/raise the size of the displacement, in case you want to use the map on a larger/smaller object than what was used when sculpting. In the example to the right, the Scale factor was lowered to 0.0035 for all axis to account for the small size of the plane it is applied to. | ||
3D RealFlow "vector" | This mode is used to render displacement maps obtained with RealFlow to displace fluids meshes and Realwave open sea surfaces. To be correctly rendered in Maxwell, the map must be exported from RealFlow in fixed Range mode. The final scale in Maxwell will depend on the scale of your fluid mesh. You have to use the Scale factor to lower/raise the amount of displacement in relation to the final object size. In the example on the right, the Scale factor was lowered to 0.0015 for all axis to properly fit a 25x25 m ocean simulated with Realwave. |