Search Keywords: PTex, VRayPTex, Mudbox

 

General

Sculpting the object in Mudbox

Painting the object

Sculpting the object

Exporting the base object and PTex maps from Mudbox

Exporting the object

Exporting the paint layers

Exporting the displacement map

Rendering the object with V-Ray

Importing the object

Importing the paint layers

Importing the displacement map

Final rendering

General

In this example we will render an object with several PTex textures painted in Mudbox using the VRayPtex texture.

Sculpting the object in Mudbox

Open your object in Mudbox. In this case, we are just going to use one of the stock head models.

 

To prepare the object for PTex paining, choose Mesh > PTEX Setup... and adjust the desired resolution of the PTex textures. In this example we just used the default settings.

Painting the object

Start painting the object as you would do normally. When you start painting a new layer, you will get the Create New Paint Layer dialog. For diffuse/specular/bump textures, an 8-bit PTex format will usually be enough. For our example we just painted one diffuse layer.

Sculpting the object

Sculpt the object as you would normally do, adding subdivision levels as needed.

 

Here is an example of the final painted and sculpted object in Mudbox:

 

 

Exporting the base object and the PTex maps from Mudbox

Exporting the object

Go back to the 0-level resolution of the object, select it and export it to an .obj file from File > Export Selection...

Extracting the paint layers

Right-click on the paint layer you want to extract, select Export selected... and choose a name for the resulting PTex file.

Extracting the displacement map

Go to Maps > Extract Texture Maps > New operation... and in the following dialog select Displacement Map.

 

For Target Models select the 0-level resolution of the object; for Source Models select the resolution that you want to bake (typically the highest resolution).

 

Turn on the Smooth Target Models option.

 

Make sure the Method is set to Subdivision (the Ray Casting method may produce artifacts);

 

Select a PTex file for the Base File Name option.

 

Set the Data Format to 32-bit float. This ensures that the displacement values stored in the texture are absolute and do not need further adjustment.

 

This is what the final extraction options should look like (click on the image for full resolution):

 

 

Click on the Extract button to create the vector displacement map.

Rendering the object with V-Ray

Importing the object

In 3ds Max, go to the File > Import... menu and import the .obj file with the 0-level resolution mesh for your object. Make sure that the Retriangulate polygons option in the OBJ importer is disabled.

Loading the paint layers

Create a new VRayMtl material, assign it to the object, and attach a VRayPtex texture to the diffuse slot. Choose the saved diffuse PTex file in the texture.

 

Note that the texture will not appear properly in the Material Editor as the preview sphere has a different topology from our object.

 

If you render the object now, it should be able to see the diffuse texture:

 

[diffuse_render]

Loading the displacement map

Add a VRayDisplacementMod modifier to the object and set its Type to Subdivision. Click on the Texmap button and select a VRayPtex texture. Instance the newly created VRayPtex texture into the Material Editor and choose the displacement PTex file. Leave the displacement Amount in the modifier to the default value of 1 generic unit.

 

For the following rendering we disabled the diffuse texture so that we can better see the displacement result:

[displ_initial]

 

As can be seen, the texture seems to be clipped in the lowest and highest parts. This is because V-Ray assumes by default that the texture value are between black and white, which is not correct in this case. To work around this, go to the VRayDisplacementMod modifier, and adjust the Texmap min and Texmap max parameters at the bottom of the rollout. In our case, through some trial and error, we found that -3.0 for the minimum value and 4.0 for the maximum remove the clipping:

 

[displ_final]

 

For smoother results, especially if you observe the displacement map from a close distance, it may be useful to set the Filter parameter of the VRayPTex texture to a smooth filter like the Bicubic one.

 

The following images show a closeup of some displacement with a Box and Bicubic filters.

 

Box filter. The pixels in the PTex file are clearly visible. Bicubic filter. The result is much smoother.

 

Final rendering

Now we can enable the diffuse texture and get our final result:

 

[final]