Skip to content

LuxRender Microdisplacement

Jason Brenneman edited this page Oct 1, 2023 · 3 revisions

Microdisplacement

Microdisplacement subdivides and displaces individual triangles on-the-fly during rendering, instead of pre-computing subdivision for the entire mesh. Since the results are not stored this makes it very memory friendly at the cost of CPU time.

Settings

  • nsubdivlevels. This setting controls the number of subdivisions that will take place during Microdisplacement. The higher the number of subdivision levels, the slower it will go. Note that it works differently than Loop subdivision, so one needs much higher levels to get the same level of subdivision compared to using Loop. If you use X Loop subdivision levels, you need N = sqrt(4^X) Microdisplacement levels to match the Loop results.
  • dmscale. This setting controls the displacement height for each triangle, and larger displacements create larger bounding boxes. The higher the setting, the more displacement can occur. The down side to that is, as the bounding box grows with the displacement amount, more triangles could be affected to allow for the increased displacement. This comes with a large speed penalty due to the increased number of base triangles that could potentially be included in the displacement.
  • dmoffset. This setting acts like a shrink/fatten modifier.

Using Microdisplacement

Now comes the tricky part, using microdisplacement. But don't worry, there are a few simple rules to help you along. The most important thing to remember when using microdisplacement is: everything is relative. If you scale down your mesh, you need to scale down microdisplacement. For example, if you create a 1 meter in diameter sphere and apply an unmodified texture using a dmscale of 0.01 to displace it by 1 centimeter, it should look good, and performance should not be affected too much. Now if you were to scale the mesh down by 0.1 to 10 cm, then you would need to scale your texture by 0.1 and scale dmscale by 0.1 as well. So dmscale would go from 0.01 to 0.001 to achieve the same effect.

When using microdisplacement, the displacement is controlled by scale*value+offset, where value is the raw texture. So if you want to invert the pattern, just use scale=-1 (or whatever suitable negative value), and adjust offset accordingly: set it to 0 to have the white part carved into the surface, or -scale to have the white part as the baseline, or -scale/2 to have a medium grey as the baseline.

Note that in the old LuxBlend (for Blender 2.49b) microdisplacement was a material option (in the materials tab). In LuxBlend25 (for Blender 2.5x) (micro-)displacement is in the mesh-tab of the object (where it belongs, because it's an mesh-option), not in the material tab.

Examples

In the following two examples, the only thing changed was the dmscale. The base mesh is roughly 500 triangles with 3 levels of Catmull-Clark subdivision applied before microdisplacement. The speed hit when doubling the amount of dmscale was nearly inversely linear, about 40 to 50 percent. Also the amount of subdivision levels plays a role in speed as well. If we were to fully subdivide the mesh to 10 levels of subdivision it would have 6,297,600 faces.

Microdisplacement_Example

With only 2 levels of subdivision done before microdisplacement, the number of base triangles drops to 15744. To achieve the same effect would then require 20 levels of subdivision.

Md_10levels_dmscale_0 0005

62976 base triangles, nsubdivlevels=10, dmscale=0.0005, ~100-110 kC/s

Md_10levels_dmscale_0 001

62976 base triangles, nsubdivlevels=10, dmscale=0.001, ~50-60 kC/s

Here is a real world example of what can be achieved with Microdisplacement. The numbers on the radio dial were created using Micro Displacement. The dial itself has 2 levels of subdivision in blender and 50 levels of micro subdivision. The dmscale amount is 0.0003.

Clone this wiki locally