This tutorial covers how to render a ZBrush displacement map with V-Ray.
This tutorial covers how to export a displacement map from ZBrush and then use it with V-Ray for 3ds Max.
Note that the settings of the VRayDisplacementMod are universal for rendering with both V-Ray and V-Ray GPU engines.
For detailed description on how VRayDisplacementMod works, see the dedicated page.
Preparing the Object in ZBrush
There are a few things to keep in mind when sculpting your object in ZBrush:
– Make sure that the object has UV coordinates and they are not overlapping;
– Make sure that there are no UVs outside the [0,1] range;
– A good workflow is to have the UV seams hidden in the least visible places.
To the right is an example of a base object in ZBrush. Only the chest armour is selected and for the purpose of this tutorial, we show only this object's displacement map export.
4096Exporting the Displacement Map
It is important to first go to the lowest subdivision level of your mode (SDiv 1). This is the base model that we import later in 3ds Max.
Go to the UV Map rollout of the Tool palette. The only thing you need to choose here is the UV Map Size. We wouldn't recommend a value higher than 4096 and in most cases, a 2k map will work just fine.
Now let's go to the Displacement Map palette.
We set the Adaptive to off. The DPSubPix option specifies the SubPixel accuracy - it actually subdivides the poly mesh x times. In this case, we leave it to 4. Note, that the time for export increases when this value is high.
Depending on the model you have and the effect you want to achieve, you will choose whether to leave SmoothUV option on or off. We leave it off here as we can later control it with V-Ray. If you are not sure what is best for your case, leave it on.
The Mid option determines where your Mid point value of the map is. Whichever point you choose (0 or 0.5), you can later adjust the Displacement in V-Ray (through Tex min/Tex map options).
Leave the Flip V option on.
Leave the 3 Channels off. This will produce a map only in the red channel, which is enough.
Enable 32Bit. V-Ray supports 32-bit maps, so it is better to keep it this way.
Once ready with these settings, press the Create And Export Map button. We save the map as a 32-bit .exr file.
ZBrush prompts you to choose whether to export only the displacement map or both the base model and the displacement map. We choose the latter in this tutorial and export the base model as an .obj file.
Here is how our .exr displacement map looks like:
Preparing the Object for Render
Let's import the .obj file in 3ds Max.
While the object is still selected, navigate to the V-Ray shelf and select the V-Ray Displacement Modifier to add.
Go to the modifier's parameters and insert a VRayBitmap in the Texmap slot. Select the exported .exr file to load in the Bitmap field.
In Color Space transfer function, choose Type None. This means that the image is in Linear space (no Gamma applied).
Now let's go back to the VRayDisplacementMod parameters.
Depending on the expected displacement, you can choose either a 3D mapping method or a Subdivision one. The Subdivision method is suitable if you need to smooth out the model. You don't need to add any smooth modifiers - the Subdivision method will automatically do the job. We use it here for the lion's head to get a more organic look.
Disable the Filter texmap option.
The default Amount and Shift options should work well in most cases, but you can play with these parameters until you get the desired look.
Regardless of what Mid point value you chose when you were exporting the displacement map, it is a good idea to preview the map and see the real pixel values in order to determine the texmap range. The Texmap min/max values need to be set according to the values of that range in order to avoid clipping by V-Ray. If you are not sure about it, you can start with values of -1/1 and see if they allow proper displacement.
Enable the Keep Continuity option. This option will help the model not to "break" over the geometry edges.
The default Edge length is 4 pixels. If you think your displacement will benefit from further subdivision of the low poly mesh, you can lower this value, but note it is on the expense of render time and RAM.
We are all set up and ready to render!
- If you are using the V-Ray GPU render engine, the 2D mapping will not work;
- This tutorial shows the steps of exporting a single low poly mesh and its render preparation with V-Ray. If you want to export the UVs of more than one mesh in one displacement map, you can use the Merge Maps option in ZBrush. In that case, it is a good idea to set the Map Border to the highest possible value.
- V-Ray supports only regular displacement map when exported from ZBrush (Vector Displacement is not supported yet).