Square Enix © Goodbye Kansas

Table of Contents

This page covers how to export a vector displacement map from ZBrush and render it with V-Ray. For a tutorial on how to render a ZBrush Displacement map in V-Ray, please visit this page.

 

Overview


 

 

This tutorial demonstrates how to render realistic objects with V-Ray for Maya using vector displacement maps from ZBrush

The settings of V-Ray Displacement nodes are universal for rendering with both V-Ray and V-Ray GPU engines. For more information, please visit the VRayDisplacement node page.

 

The vector displacement files for this tutorial can be downloaded from here.

 

 

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

  • The UVs should not be too close to the edge of the UDIM

  • Make sure that there are no UVs outside the [0,1] range

  • For a more appealing look, place the UV seams in the least visible areas

  • Plan the sculpture beforehand and optimize the base mesh. Make sure that the places with the most deformation are the most densely subdivided. This has a huge impact on the final outcome 

 

 

We recommend using a more detailed object, instead of a low poly one.  Delete some of the Lower Subdivs from the detailed base mesh and use that. This will ensure that some of the deformations are already available on the low-poly mesh and give you sharper details on the high-poly one.

 

ZBrush Vector Displacement Configuration


 

It is important that this part of the tutorial is followed carefully; otherwise, the vector displacement maps won’t be generated properly and the V-Ray render output will not match the Zbrush geometry. For more information, please visit the  Diagnostic File for Perfect Export Settings page.

 

Vector displacement maps are not yet standardized within the industry. Each render engine approaches these maps differently and could produce a different outcome. Find the correct combination of color order and direction for your workflow.

To avoid manually testing all these different combinations, ZBrush has an option to Create Diagnostic Files based on your export settings.
It is located in the Tool > Vector Displacement Map sub-palette. These diagnostic files consist of an OBJ file, a diffuse map and the generated vector displacement map.

 

  1. Load the OBJ file into Maya and create a material. Attach the vector displacement and diffuse maps to the new material . After that, render the 3D model. You will see a checkered, numbered grid with 3D objects floating on top of it . One of the shapes is a perfect sphere, while the others are imperfect spheres or non-spherical shapes.

  2. Beneath each shape is a number. Note the number found beneath the perfect sphere. Return to ZBrush and go to Preferences > ImportExport and set the FlipAndSwitch and the Tangent FlipAndSwitch options to this value.

 

 

 


 

  1. Save your settings by going to Preferences > Config and clicking on Store Config. Alternatively, use the Ctrl+Shift+I (Cmd+Shift+I for Mac) keyboard shortcut.

  2. Once your ImportExport sliders are set and saved for your target application, all of your vector displacement maps will export correctly for that particular application.

 

 

Exporting the Vector Displacement Map


 

  1. Go to the Zplugin > Multi Map Exporter

  2. Enable the Vector Displacement option. If you want to export the mesh as well, enable the Export Mesh option. 

  3. Go to the Map Size to regulate the UV Map Size. We recommend values between 2048 - 4096, to make sure it has enough details but is also optimized.
     

  4. Enable the 32Bit option, which has a depth factor value baked in it. V-Ray supports 32-bit maps. You do not need to enter the depth value in the render engine manually.  This means you will achieve a more accurate result with less effort.

  5. Once ready with these settings, click on the Create All Maps button. Save the map as a 32-bit .exr file.















Here is how the exported .exr map looks like


 

 

 

 

Preparing the Object for Rendering


 

Import the .obj file into Maya by going to File > Import… and set the File type to OBJ.

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 enable:

  • Displacement control
  • Subdivision and Displacement Quality
  • Subdivision

 

These extra attributes provide control over the displacement and subdivision of the object. Once you add them, you can find their parameters under the Extra V-Ray Attributes rollout.

 

 


 

 Go to the vrayDisplacement node in the Attribute Editor. Open the Displacement rollout and attach a File node to the Displacement Texture.

 

 

 


 

In the file's attributes, go to the Image Name field and attach the exported .exr file from Zbrush.

 

 

 


 

Now let's go back to the object’s Extra V-Ray Displacement Attributes we added earlier.

  • Make sure the Displacement type is set to Vector Displacement (object)

  • Enable the Keep Continuity option. This option helps the model not "break" over the geometry edges.

  • Keep the Enable Water Level option disabled. No need for the geometry to be clipped away.  

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

 

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

 

The Subdivision and Displacement Quality panel controls the displacement quality by manipulating the underlying mesh's Еdge length. Setting the Edge length to a lower number will give you a higher level of detail but at the cost of longer render time and more RAM. Find the most optimal value for your scene.

 

We are all set and ready to render!

 

Final Result


 

Here is a side-by-side comparison of the ZBrush Geometry and the V-Ray Displacement geometry. You can see the two are identical.