Ptex has been around for a few years now, but the lack of support in major render packages and 3D programs made it difficult for freelance artists to integrate into their own pipeline. I decided to give it a try in my current project and see the pros and cons by myself. So in this post I am going to show you how I painted ptex textures in mari and the workflow you need to follow if you want to test it on your own projects. Along the way a few photoshop and mari tips.
I am using arnold render but if you are using vray or a recent version of mental ray you should be able to follow along. Arnold doesnt have yet official support for ptex, but I found a website where you can download the arnold ptex plugin, just search in the plugins/download sections and if you can’t find a compatible version for you Mtoa, email the developer and he will send it to you.
So ptex as you may know is a way to texture paint 3D models without making any UV’s, each face has an “ID” and it stores all the texture information in a “.ptx” file. I decided to try ptex because I have a lot of individual objects to texture. Since most of the objects will be seen from distance a procedual aproach would be a good choice, but you never know if you will need a close-up render. Anyway, I thought that I could merge some objects in some logical way,paint them inside mari and export as a ptex texture instead of dealing with uv’s or any procedual texturing complex networks. I will only use this in the objects that are closer to the camera or need a more “textured look”.
Exporting the models
As a first test I combined these 3 objects to be exported. The first limitation, at least in arnold, is that you need export your models already subdivided, no render time subdivisions. So, use the smooth mesh preview options in the shape node of your objects and then Modify >> convert >> smooth mesh preview to polygons. Do this step before you combine the obejcted so you can have individual control of the smooth level. You could create individual ptex textures for all of your objects, but I want to keep the “file management” and shading networks simple.
Projections camera and reference material
One advantage of having good uv’s is that you can paint decals/text details with ease since the uv’s are in 2D space. So I found a good idea to export an animated camera with 3 frames representing the 3 objects. I just used the view >> align camera to polygon and then dolly out. The idea was to have front projections bookmarks instead of orbiting around the models in mari. Just export your camera as .fbx. Also created a reference image at this point to use in mari.
Create your mari project, then you will get pop-up windows asking about ptex. Make sure you set force Ptex, and chose uniform face size , in my case I used 32×32 and you can always change the face texture size later. Now import you fbx camera exported from maya by selecting camera >> load camera. Make sure you have the play controls visible selecting view >> palettes >> play controls, this way you can jump between frames. Use this camera only for projections, to orbit around your scene use the default perspective/orthographic views.
Using quick projection in mari and photoshop
So I wanted to project some text detail into my first obejct, and for that I will use mari projectors with photoshop. Go to camera >> quick projection settings, set the resolution and the psd file path (ex: …/project_text.psd). Then go to camera >> quick unproject. Open your psd file in photoshop, create a black background if you need, a reference image and maybe setup some guides.
In this parrticular case I need text to flow around a circle. To do this in photoshop is really easy, just create an ellipse shape at the right positing and hover the ellipse shape path with the text tool selected and just type anything you need. In case you need text facing other direction you can use edit >> transform path >> flip h/v. Create any other texture pattern/details to project inside mari. Then you will need to save the psd file, I like to merge all the layers unless I need to project into separated layers inside mari, if for any reason you want to edit the text or any particular layer of this psd, save a copy of it or you can use the the undo after. Hide your the “helper” layers and merge everything you need, make sure you also hide any background or mari exported texture.
Mari face masks and projections
Now back to mari, before we project anything, we need to create a group to mask the individual objects. So select the faces of your object, make a group in the layers palett, select it and right click >> layer mask >> add mask >> hide all. Now set your foreground/background color to white and in the ptex menu choose fill faces foreground. Create all the textures for this object inside this group
Let’s get back to the projection, go to your projection camera bookmark/frame, create an empty layer and select camera >> quick project front.
Now use the painting tools and procedual layers like color and tri planar projection to create your final textures. Use the same masking aproach to texture and isolate the other objects, you can also paint other types of maps like specular, creating a new channel.
When you have your textures ready right click on layers palett empty space, and choose export >> export all layers flattened. Chose the location of your ptex file and give it a name, in my case I used prefix.$CHANNEL.ptx.
Ptex in maya with arnold
Now inside maya, create a aiBeshaPtex node and chose the location of your ptx file. Now just use it as a normal file texture in your shading networks. you will need to apply a gamma correction of 0.4545 depending on your color space workflow.
Finally 2 important steps. Select you object and in the uv texture editor or edit uv’s menu item, choose polygons Unitize , and the final step is to check Export faceId in the arnold tab of your object’s shape node.
Ptex or not Ptex
If you follow the steps everything should be rendering fine by now. So is it worthed? I elaborated a list of pros and cons based only in this simple test and arnold workflow, but feel free to experiment and play with it, may come in handy in your own projects.
I think Ptex has amazing potential, and yet, already production proven. Of course when solidangle release official support for ptex we should be able to do more and have less limitations of the current workflow. Well, for now it works and you can definitely use it on your next project. Please leave a comment if you have any questions or want to share your experience/opinion. See you next time.
Some of you asked me about vray and mental ray support for the viewportRender tutorial/tool. I have updated it a few days ago, and it can now support any render engine that works with maya. Make sure you download the latest version of the tutorial and tool.