---
title: "Rendering Vector Displacement with Object-Space PTex"
canonical: "https://documentation.chaos.com/space/VMAX/113575507/Rendering%20Vector%20Displacement%20with%20Object-Space%20PTex"
format: markdown
---
This page provides a tutorial on rendering vector displacement using PTex Textures.

## <span style="color: #000000">**Overview**</span>

---



## <span style="color: #000000">**Exporting the Object from Mudbox**</span>

---

<span style="color: #000000">We will base the render on the subdivision level 0 of the mesh, so we need to export that. Go to level 0, select the object and then go to </span><span style="color: #000000">***File > Export***</span><span style="color: #000000">* selection...*</span><span style="color: #000000"> and choose an </span><span style="color: #000000">*.obj*</span><span style="color: #000000"> file name. Then save the .</span><span style="color: #000000">*obj*</span><span style="color: #000000"> file.</span>


![image](media://85a7a699-4c17-470a-8975-8b4a463722d1)



## <span style="color: #000000">**Extracting the PTex Texture in Mudbox**</span>

---

<span style="color: #000000">Assuming that your object is already sculpted in Mudbox, first make sure that you set it up for PTex textures. To do this, in Mudbox go to the lowest subdivision level and then go to </span>***UVs & Maps > PTEX Setup...***<span style="color: #000000"> and adjust the PTex resolution as needed:</span>


![image](media://5dd572e8-28b6-46b5-a2f8-79308ecf973c)


<span style="color: #000000">To extract the PTex texture, go to </span><span style="color: #000000">***Uvs & Maps > Extract Texture Maps > New Operation...***</span><span style="color: #000000"> and choose </span><span style="color: #000000">**Vector Displacement Map**</span><span style="color: #000000">.</span>

<span style="color: #000000">Set the </span><span style="color: #000000">**Map Type**</span><span style="color: #000000"> to </span><span style="color: #000000">**Ptex,**</span><span style="color: #000000"> set the </span><span style="color: #000000">**Texel Distribution**</span><span style="color: #000000"> to </span><span style="color: #000000">**Use PTEX Setup**</span><span style="color: #000000">; set the </span><span style="color: #000000">**Vector Space**</span><span style="color: #000000"> to Object, and make sure that </span><span style="color: #000000">**Include Mesh Data**</span><span style="color: #000000"> is </span><span style="color: #000000">**enabled**</span><span style="color: #000000">. The mesh data is needed during rendering to correctly transform the vector displacement on deforming meshes.</span>

<span style="color: #000000">The extract dialog should look like the picture below. Click on the </span><span style="color: #000000">**Extract**</span><span style="color: #000000"> button to create the PTex texture.</span>


![image](media://873e5121-7169-46d9-bcc2-7ac03ba055a0)


## <span style="color: #000000">**Rendering with V-Ray**</span>

---

<span style="color: #000000">First, import the level </span><span style="color: #000000">*0*</span><span style="color: #000000"> version of the object that you exported to an .</span><span style="color: #000000">*obj*</span><span style="color: #000000"> file earlier. Go to </span><span style="color: #000000">*File > Import...*</span><span style="color: #000000"> and select the </span><span style="color: #000000">*.obj*</span><span style="color: #000000"> file. Make sure that the </span><span style="color: #000000">**Retriangulate Polygons**</span><span style="color: #000000"> option is </span><span style="color: #000000">**disabled.**</span><span style="color: #000000"> Since the PTex textures are tied to the mesh topology, it is vital that the mesh is imported in 3ds Max exactly as it was in Mudbox.</span>


![image](media://7c58d0ef-db3c-4986-af38-d496c73a7245)



<span style="color: #000000">Next, apply a</span> [VRayDisplacementMod](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113585664) <span style="color: #000000">modifier to the object, set the </span><span style="color: #000000">**Type**</span><span style="color: #000000"> to </span><span style="color: #000000">*Subdivision*</span><span style="color: #000000"> and turn on the </span><span style="color: #000000">**Classic Catmull-Clark**</span><span style="color: #000000"> option. Set the </span><span style="color: #000000">**Vector displacement**</span><span style="color: #000000"> mode to </span><span style="color: #000000">*Object*</span><span style="color: #000000">. Click on the </span><span style="color: #000000">**Texmap**</span><span style="color: #000000"> button and select</span> [VRayPtex](https://docs-chaos.atlassian.net/wiki/spaces/VMAX/pages/113575832)<span style="color: #000000"> texture. Instance the texture to a slot in the Material Editor, click on the </span><span style="color: #000000">**filename**</span><span style="color: #000000"> button and select the </span><span style="color: #000000">*.ptx*</span><span style="color: #000000"> file that you exported earlier.</span>

<span style="color: #000000">If you render now, you will see that the object is smooth, but it is not displaced properly. This is because, for PTex textures, V-Ray cannot figure out the displacement bounds automatically. You will need to specify the displacement bounds explicitly. To do that, go back to the VRayDisplacementMod modifier and adjust the </span><span style="color: #000000">**Texmap min**</span><span style="color: #000000"> and </span><span style="color: #000000">**Texmap max**</span><span style="color: #000000"> parameters, decreasing the first and increasing the second until the displacement looks correct. For this particular scene, good values turned out to be about </span><span style="color: #000000">*-60*</span><span style="color: #000000"> for </span><span style="color: #000000">**Texmap min**</span><span style="color: #000000"> and </span><span style="color: #000000">*60*</span><span style="color: #000000"> for </span><span style="color: #000000">**Texmap max.**</span>

<span style="color: #000000">If the texture displaces the surface quite far from its original position, you may need to adjust the tessellation for the subdivision surface. To do this, decrease the </span><span style="color: #000000">**Edge length**</span><span style="color: #000000"> parameter in VRayDisplacementMod to 2.0 or even 1.0.</span>

<span style="color: #000000">At this point, the displacement modifier should look like this:</span>


![image](media://af0cb7d5-6d2a-4497-8aa8-8ecb45bde2a7)


<span style="color: #000000">You may notice slight noise or moire effect in the displacement. To fix this, go back to the VRayPtex texture and set the </span><span style="color: #000000">**filter type**</span><span style="color: #000000"> to</span><span style="color: #000000">** Bilinear**</span><span style="color: #000000"> or</span><span style="color: #000000">** Bicubic**</span><span style="color: #000000">.</span>

<span style="color: #000000">Now the object should look the same shape as in Mudbox.</span>



## <span style="color: #000000">**Optimizing the Render**</span>

---

<span style="color: #000000">Depending on the settings, rendering with Ptex vector displacement might be slow. You can speed it up a lot in exchange for some additional RAM if you turn go to the VRayDisplacementMod modifier and turn on the </span><span style="color: #000000">**Static Geometry**</span><span style="color: #000000"> and </span><span style="color: #000000">**Cache Normals**</span><span style="color: #000000"> options. The </span><span style="color: #000000">**Static Geometry**</span><span style="color: #000000"> option will make V-Ray pre-tessellate the object at the start of the frame and treat it like regular geometry instead of render-time displacement. This allows you to use the Embree raycaster to further speed up the rendering. The </span><span style="color: #000000">**Cache Normals**</span><span style="color: #000000"> option causes V-Ray to pre-calculate the surface normals, giving an additional speed boost although at the expense of slight errors in the normals due to interpolation.</span>




## <span style="color: #000000">**Deforming the Object**</span>

---

<span style="color: #000000">Object-space displacement generally stores the displacement values relative to the original object mesh. If the object is deformed in some way, then the displacement values are no longer valid. However, since the PTex file can store</span> <span style="color: #000000">information about the original object mesh, V-Ray is able to use the difference between that original mesh and the deformed one in order to recalculate the displacement values for the deformed state. V-Ray does this automatically; no extra effort is required from the user so long as the PTex file includes mesh information.</span>