Saturday, April 14, 2012

How to make Mental ray's tessellation match Maya's tessellation in Nurbs.

When you use nurbs surface, from time to time, you might want to how its tessellation.
You can simply turn on Display Render Tessellation option under Tessellation section in the attribute editor to see it. But that's for Maya software render and  doesn't necessarily match Mental ray's tessellation.  To be able to mental ray's tessellation, you need to use Mental ray's contour rendering feature.
Here I have two simple nurbs sphere. For comparison,  I turned on Display Render Tessellation option
for the sphere on the right side. And I also turned on Enable Advanced Tessellation. This is to explicitly assign the number of tessellation for each span for the sphere.

Next, I will create a new surface shader and assign it to the sphere on the right. This shader is for contour line.  After the shader assignment, select the shader's shading group node and open the attribute editor.

Turn on Enable Contour Rendering option and change the color to black.
You would also need to adjust the line width to something like 0.5.
Now, go to Render Settings  

Under Features tab, go to Contours to turn on Enable Contour Rendering and check Around render tessellation. Now, render.
Here's the render result.

You may want to adjust the filter settings of the countour render to get a better line quality.
Here's the setting that I used.
Over-sample : 3
Filter Type : Triagle
Filter Support : 1.5
Not only these, anti-aliasing quality should influence the final quality. So, set it high.

Ok, so far, so good.
Now, let's compare the Maya's tessellation and Mental ray's. By default, they don't match.
Compare the first image and the last image.

The first one shows more triangles. If you are in a situation where you need to mix two renderers, this could be a problem since the object's profiles don't quite match. But the solution is quite simple.
Turn off Use Chord Height Ratio of the sphere.

Finally, the sphere's tessellation has become identical from both renderers.

Well...that's all folks!

No comments:

Post a Comment