Tuesday, May 15, 2012

Mudbox PTEX to RenderMan in Maya

Ptex, a fantastic up and coming displacement system utilized in Toy Story 3 in order to allow high polygon models to be animated with ease while in their low-res versions.  The best part being, NO UVs REQUIRED.  That's right, it blows my mind entirely!

 For the uninitiated, here is Pixar presenting a tech demo of exactly what the technique is capable of.



Here is my model in Mudbox at its highest and lowest subdivision levels.


The first thing you'll want to do is set up your model for Ptex.  Navigate to Mesh > PTEX Setup.


This will instantly add an interesting blue diamond grid to your model.  How crisp and clear the edges of this grid are will determine the resolution of the final displacement.  Hit the Decrease and Increase buttons at the top of the screen to taste, raising the resolution too many times will result in a ridiculously large and unwieldy file.




Hit the Done button and your model is fully set up for Ptex.
Next we will send the base mesh to Maya, sometimes the actual Send to Maya options can be a bit squiffy, so I would recommend selecting your mesh and exporting as an .obj to then import into Maya.



Make sure Renderman is your renderer in Maya.


Still in Mudbox, select Maps > Extract Texture Maps > New Operation...


In the following pop-up, you will want to select Vector Displacement Map.














Check to make sure the top box has your model at the lowest possible mesh and the bottom, the highest.

Depending on the model, feel free to change your Image Size and be sure to set the Vector Space to Object.
Click the folder icon next to Base File Name and a Save As window will appear.  This window defaults to .tiff so be sure to manually change the Save as type to Ptex file.


For some reason, selecting this option causes Mudbox to repeat the extension, so be sure to fix that before hitting the Extract button on the bottom of the Ptex window.


Now to Maya.
Select the .obj of the base mesh you imported of the model and, in the Attribute Editor under the shape tab, select Attributes > Renderman > Ptex Support.



Repeat this, only with Subdiv Scheme.


Open Slim using the icon with the S surrounded by yellow boxes in the RenderMan tab.


Once Slim is open, create a new palette and throw down an AllPurpose shader.
Scroll to Displacement and click the little icon next to it that appears to be molded clay.
Select Connect...


Add the Displacement node.


Enter the Displacement node and click the blue arrow icon next to Input Vector and Connect... it to a Ptex Vector.


This will add an option for importing your .ptex file.
Click the newly appeared folder icon and open your file.


Start your Scale off at 1.


In your AllPurpose node, 2.7 is a good start for your Displacement Bound.


Select your object in the viewport and then right click on the AllPurpose.
Choose Attach as surface and then render the scene with Renderman.


I am quite happy with the final results, for this particular model I ended up upping the Displacement Bound to 100 in the All Purpose node and the Scale to 150 in the Displacement node.

The render below took 0:05 to render at 960x720.  That's pretty dang good for a displacement.  It is easy for me to see why this method is so attractive.  


Here is the model rendered in Maya Software...


...and the Mudbox Ptex, rendered using Renderman in Maya



Happy sculpting, animating, and rendering!
Josh Evans

3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thanks for this, very useful.

    Nick.

    ReplyDelete
  3. I've followed this word for word, but it doesn't seem to work for me.
    I'm building terrain for a snowy mountain peak in exactly the same formats we have here. But i'm only getting the low poly in the render.
    Might be worth mentioning when I up the disc scale and the disc bound, it absolutely explodes in all directions.

    ReplyDelete