Square Enix © Goodbye Kansas

Table of Contents

This page covers how to render a ZBrush displacement map with V-Ray. If you would like to see how you can render ZBrush Vector Displacement with V-Ray, please see this tutorial.

Overview


This tutorial covers how to export a displacement map from ZBrush and then use it with V-Ray for Maya.

Note that the settings of V-Ray Displacement node are universal for rendering with both V-Ray and V-Ray GPU engines.

For detailed description on how VRayDisplacement node 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.

 

 

Exporting 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 4069 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 Min/Max value 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


Import the .obj file in Maya by going to File > Import...

While the object is still selected, navigate to the V-Ray shelf and assign a VRay Displacement node.

 

 


 

In the Attribute Editor, go to Attributes > VRay and select the Displacement control, Subdivision and Displacement Quality and Subdivision options.

Those extra attribute provide us with control over the displacement and subdivision parameters. Once you add the extra attributes, you can find their parameters under the Extra VRay Attributes rollout.

 

 


 

While at the vrayDisplacement node in the Attribute Editor, go to the Displacement rollout and attach a File node to the Displacement mat.

In the File's attributes, go to the Image Name field and open the exported .exr.

 

 


 

Now let's go back to the Displacement extra attributes we added earlier.

Make sure the Displacement type is set to Normal Displacement. Usually the default Displacement Amount and Shift values should work fine, but depending on the effect you are after, you can play with them.

Enable the Keep Continuity option. This option will help the model not to "break" over the geometry edges.

Disable the Filter texture option. If the effect you are after is some hard edges and/or creases, this filter map will smooth them out. So in that case it is better to keep it disabled.

It is important to set the Displacement bounds to Explicit. This way you can adjust the Min and Max values to get proper displacement for your model and not get clipped by V-Ray. 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 displacement bounds. 

Select the Min value and set the Color Space to RGB 0 to 1. Then set the RB and G to a negative value appropriate for your displacement map. Do the same for the Max value. In the case with the armour, we are using values of -5/5.

The default Subdivision settings are enough in this case. We need this extra attribute to smooth out the base mesh UVs.

In the Subdivision and Displacement Quality panel you can control the displacement quality by manipulating the underlying mesh's edge length. 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 set up and ready to render!

 

 


 

Here is a short example comparing the low poly base mesh without Displacement and with Displacement enabled.

 

 

Notes


  • 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.