Modifying Objects Using an Image - Method 2
Like the DisplaceGeo node, the Displacement shader node also performs displacement mapping and at first glance the nodes seem very similar. However, the approach they have on performing displacement mapping is different.
Displacement mapping is a technique for adding geometric detail to object surfaces as you render them. Unlike the DisplaceGeo node, The Displacement node does this on the fly, only displacing those parts of the geometry that are visible at any given moment. Displacement considers the point of view of camera to determine which parts of the displacement need rendering, thus saving render time. It’s also possible to optimize the level of tessellation to be the level that you need for an object at a certain distance.
Connecting the Displacement Node
1. | Create the Displacement node by clicking 3D > Shader > Displacement. |
2. | Connect your geometry to the Displacement node’s output. If you want, you can connect a texture to the Displacement node’s input. |
3. | Connect the image you want to create the displacement from in the displacement input. |
4. | Optionally, you can use a separate map for calculating the normals. Connect this to the normals input. |
5. | Proceed to Adjusting the Displacement Controls below. |
Adjusting the Displacement Controls
1. | Use the displacement channel dropdown menu to select the channel from your displacement input that you want to use as the displacement map. |
2. | If you’re using a normals input, uncheck build normals and set normal expansion to: |
• none to use the normals as they are,
• XY to multiply them on x and y dimensions, and
• XYZ to multiply them in x, y and z dimensions.
3. | Use scale to set the overall scale of the displacement. |
4. | Set filter size to the size of the filter you want to use when sampling the input image. |
5. | Use the filter dropdown menu to select a filtering algorithm. For more information, see Choosing a Filtering Algorithm. |
6. | If you want to automatically calculate normals after the displacement, check build normals. Uncheck this, if you want the normals calculated from the normals input. |
7. | Proceed to Adjusting Displacement Controls for Rendering below. |
Adjusting Displacement Controls for Rendering
Before rendering a scene where you’ve used Displacement, adjust the controls on the Tessellation tab to gain speed and quality for the render process:
1. | Use max subdivision to set the maximum number of iterations of polygon subdivision that occurs in tessellation. |
If you’re used to working with DisplaceGeo or displacement in other applications, it’s worth noting that you can get a similar amount of detail with lower geometry subdivisions using the Displacement node.
For example, a 30x30 Card is constructed from the tessellation of 1800 triangles (30x30x2), but you can achieve a similar tessellation levels using the Displacement node with fewer card subdivisions:
Card subdivisions |
max subdivisions |
tessellation triangles |
1x1 (2 triangles) |
5 |
2048 |
2x2 (8 triangles) |
4 |
2048 |
4x4 (32 triangles) |
3 |
2048 |
Note: Using a high number of geometry and Displacement subdivisions is likely to slow down rendering so far it becomes unusable - A 10x10 card with max subdivisions set to 4 generates 51200 triangles!
2. | Set the mode dropdown menu to the mode used in polygon subdivision: |
• uniform - uniform polygon tessellation. This is a good option mainly for testing your result, and only in rare occasions the best option to actually use for a displacement render.
• screen - tessellation is determined by the screen size. This is the default and often the best mode option. The tessellation is determined by the size of the tessellate polygons on the screen. This mode ensures that no new polygons are created once a particular polygon edge screen length is reached.
• adaptive - tessellation is determined by the complexity of the displacement. This option attempts to estimate flat areas in the image where tessellation is unnecessary. The calculation is based on the threshold controls which are only active if the adaptive mode is selected.
3. | If you set mode to screen or adaptive, set pixel edge length to the maximum size of polygons used in tessellation. |
4. | If you set mode to adaptive, you can also adjust the following: |
• edge threshold - edges larger than this threshold get divided, whereas edges smaller than this are subdivided according to the normal and displace thresholds.
• normal threshold - detects normal orientations to determine if the surface is flat or not. If the angle between adjacent normals is larger than this threshold, tessellation occurs.
• displace threshold - compares the degrees to which two points on the surface are displaced, and if the results do not match, tessellation occurs.
Note: Keep in mind that applying the Displacement shader to a very complex high resolution geometry can be very slow.