Displacement texture map from JSplacement
Rollover image to view without displacement
Displacement maps can be an excellent tool for adding surface detail that would take far too long using regular modeling methods. Displacement mapping differs from bump mapping in that it alters the geometry, and therefore will have a correct silhouette, and self-shadowing effects. Depending on the type of input, the displacement can occur in two ways: Float, RGB & RGBA inputs will displace along the normal while a vector input will displace along the vector.
The example above shows how a simple plane, with the addition of a displacement map, can produce an interesting looking simple scene.
You should ensure that your base mesh geometry has a sufficient number of polygons otherwise subtle differences can occur between the displaced low-resolution geometry and the high-resolution mesh from which it was generated.
Make sure that you use a 32-bit or 16-bit floating-point format to store your image, and not an integer format. An integer format will not work correctly. This is because integer formats do not support negative pixel values, which are used by floating-point displacement maps.
An example of a scene using displacement in MtoA can be found here.
Left: Brick texture -> Displacement node -> Shading Group of Ai Standard Surface shader. Right: aiImage -> Displacement (Out Color R).
The Displacement node must be connected to the displacement attribute of the shading group of the material that is assigned to the mesh that requires displacement.
Always ensure that you use the highest quality texture maps for displacement mapping. Arnold works well with very high-resolution maps, as long as the maps have been pre-processed with the maketx utility. It will convert them into .tx files (which are tiled, mipmapped files). See the pages about the maketx utility and .tx files.
When using Color Management in Maya (2017), displacement maps should be set to RAW. More information can be found here.
Subdivision Iterations set to 8. Subdivision Type set to Cat Clark.
Changing the Subdivision Type to either Catclark or Linear subdivision rules and increasing the iterations will improve the displacement quality. In this example, the Subdivision Iterations have been increased to 8.
You must be careful when increasing the number of subdivision iterations (each iteration quadruples the geometry). This subdivision happens at render time, whenever a ray hits the bound box of the object. This is a better choice compared to increasing the subdivisions of the mesh within the DCC software (which will send the tessellated geometry to the renderer).
It is possible to set displacement settings on a per-face or per-object basis. However, any values that are entered in the Arnold attributes of the displacement node will override those settings. With multiple displacement shaders per object, and since an object can only have one value of Bounds Padding, Arnold takes the maximum value from all of them. Autobump poses the same problem as with padding, and so Arnold enables it if at least one of the displacement shaders has it enabled.
As well as the Displacement Shader, MtoA also has displacement options on a per-object basis. This means that any changes to the displacement that are made on a mesh will modify the default displacement shader attributes. This may be useful in a scene that has two objects with the same shader but requires different shape displacement values. Another example would be an object that has more than one shader but requires two different Height values such as in the example below:
Same displacement shader assigned to two meshes, however, the mesh on the right has a per-object Height of 2
The per-object MtoA displacement attributes are divided into the following groups:
Controls the amount of displacement. Displacement height can have either positive or negative values. This attribute only applies with normal displacement. You can use this value to compensate for any inconsistencies between the exported displacement map and the low-resolution geometry.
Padding defines how much to extend the bounding box of the object so that it can include any additional displacement coming from the displacement shader. When the bounding box is hit first by a ray, the displacement will be computed, so an unnecessarily high value will decrease the rendering efficiency. On the other hand, a low value could result in a clipping of the displaced mesh.
The proper workflow for displacement in Arnold is to have the shader give the final displacement value and then to offset the bounding box with the bounds padding attribute.
The mesh on the left has a bounds padding value of 0.5 and the mesh on the right has a bounds padding value of 1 (per object settings).
Below is another example of a situation where bounds padding is required. A checker texture is connected to a displacement shader that is assigned to a sphere. In the image on the left, parts of the render return black. This is because the Bounds padding needs to be increased for the displaced mesh. Increasing the Bounds padding to 3 fixes the problem. This effect may increase or decrease depending on the scale of the object that is being displaced and the amount of displacement used.
This is a floating point value which is applied as a shift to the displacement amount. It defines the value of the displacement map that is considered to be zero displacement. This value can vary depending on how the displacement map has been generated.
A scene that demonstrates scalar zero value can be found here.
Autobump puts the high frequencies of a displacement map into the bump attribute so that you do not need as many Subdivision Iteration values. Autobump is visible to camera rays only by default. The visibility parameters let you make Autobump visible to other rays (eg Specular and Transmission) however that can increase render times.
The Autobump algorithm needs UV coordinates to compute surface tangents. Make sure your polymesh has a UV set applied.
When Autobump is enabled, Arnold makes a copy of all of the vertices of a mesh before displacement (let's call that the "reference" mesh, or Pref). Prior to shading at some surface point on the displaced surface P, the equivalent Pref for that point is found on the non-displaced surface, and the displacement shader is evaluated there (at Pref) to estimate what would be the equivalent normal at P if we had subdivided the polymesh at an insanely high tessellation rate.
The main difference between Arnold's Autobump and using the displacement shader for bump mapping is that Autobump has access to Pref whereas bump2d does not and would be executing the displacement shader on already-displaced points which could "compound" the displacement amounts.
The only extra storage is for copying P prior to displacement. There is no analysis of the displacement map; Arnold displaces vertices purely based on where they "land" in the displacement map (or procedural) regardless of whether it happens to "hit" a high-frequency spike or not.
You will have to refresh the IPR when adjusting these per-object attributes (this is not necessary when adjusting the Displacement Shader attributes).
Care should be taken when using both of these attributes at the same time. The relationship between the displacement shader and the per-object mesh displacement varies when rendering. These differences are as follows:
If the per-object Height value is increased when there is already some Displacement Scale it will have a multiplying effect on the displacement. For example, if the Displacement Scale is set to 0.1 in the shader and the per-object Height is increased from 1 to 2, the Displacement Scale will double in size to 0.2:
The effect of the Displacement Scale doubles from 0.1 to 0.2 when the mesh Displacement Height is set to 2.
The attribute value that is the highest is the one that will be used when rendering.
Scalar Zero Value
If the per-object Scalar Zero Value is increased when there is already some Displacement Scale it will have an additive effect on the displacement. For example if the Scalar Zero Value is set to 0.2 in the shader and the per-object Scalar Zero Value is set to 0.2, the Scalar Zero Value will double in size to 0.4:
If autobump in the displacement shader is enabled it will always be enabled. If autobump in the displacement shader is disabled, MtoA will read the shape autobump attribute and export that.