---
title: "Rendering PTex Textures from Mudbox"
canonical: "https://documentation.chaos.com/space/VMAX/113575501/Rendering%20PTex%20Textures%20from%20Mudbox"
format: markdown
---
This page provides a tutorial for using the V-Ray Ptex Map to render Mudbox PTex textures.


## **Overview**

---


## **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 painting, choose ***UVs & Maps > 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 normally. When you start painting a new layer, the **Create New Paint Layer** dialog will appear. 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, adding subdivision levels as needed.

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


![image](media://982426d4-ecd6-4888-8d9b-c0c73ef65150)


## **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*** UVs & 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 **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:


![image](media://b1a6fcc8-1fcb-4d43-8691-b45ad229eb5b)


Click on **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](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113586760), 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 access the diffuse texture:


![image](media://0fe19471-05f6-47b0-94fa-83b274e2fe58)



### **Loading the Displacement Map**

Add a [Displacement](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113585664) modifier to the object and set its [Type](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113585664/VRayDisplacementMod#Type) to **Subdivision**. Click on **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:


![image](media://e0f6dc2c-d4f1-4c32-9332-e3d642c87008)



The texture seems to be clipped in the lowest and highest parts. This is because V-Ray assumes by default that the texture values 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](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113585664/VRayDisplacementMod#TexMapMinMax) parameters at the bottom of the rollout. In our case, through some trial and error, we found that using -3.0 for the minimum value and 4.0 for the maximum removes the clipping: 


![image](media://c8ee85da-75dc-48ff-94ea-ce1441a97a85)



For smoother results, especially if you observe the displacement map from a close distance, it might be useful to set the [Filter](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113585664/VRayDisplacementMod#FilterTexmap) parameter of the VRayPTex texture to a smooth filter like the **Bicubic **one.

For comparison, the following images show close-ups of displacement with the **Box **and **Bicubic **filters.


** **

### **Final Rendering**

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


![image](media://e7283e82-9702-4cea-872d-83f62432c2d8)