View Full Version : See the tesselation wireframe on render

Haider of Sweden
09 September 2004, 04:33 PM

Is it possible to see the tesselation wireframe when rendering with mental ray? I want to see how the surface approximation affects the tesselation.

09 September 2004, 01:04 AM
Yes, you can do that by using Contour rendering. In Maya 6 follow these steps:

1. Open the Render Globals for Mental Ray and scroll down to the Contours section.
2. Open that section up and tick the 'Enable Contour Rendering' to turn it on.
3. In my case I set 'Over-Sample' to 2 and 'Filter Support' to 0.75 (under Quality) to get smooth results.
4. Scroll down a bit further and expand the 'Custom Shaders' section.
5. Apply a 'contour_contrast_function_levels' shader to the 'Contrast Shader' slot.
6. Apply a 'contour_store_function' shader to the 'Store Shader' slot.

In the attributes for the 'contour_contrast_function_levels' shader, you only need the 'Diff_index' box checked, it will cause Mental Ray to draw contours around every triangle, the other options don't affect that really.

7. Close the Render Globals!
8. Select the object you wish to see the contours on and open the Attribute Editor.
9. Navigate your way to the Shading Group (eg lambert2SG) node that lists all the Mental Ray shader slots (it's a step backwards from the actual shader).
10. Apply a 'contour_shader_simple' shader to the 'Contour Shader' slot.

Choose a colour and a width for the contours! I kept mine on black, but changed the width to 0.15.

That should work now when you render! Note though that it will draw contours onto every object that has the same lambert (or whatever) shader applied to it.


09 September 2004, 02:55 AM
I've attached an example render showing a NURBS sphere with a fractal displacement map.

And I forgot to mention that if you want a render like my attached one, just set your objects shader colour to the same as your background colour. And to get a wire alpha channel, set your lambert's (or whatever) Matte Opacity to 0.


Haider of Sweden
09 September 2004, 10:56 AM
Jozvex, thank you kindly for your very good explanation.

something tells me, you're a guru in mental ray :)

Why did I want to see the wireframe? Because, I cant make the displace/subdiv approx. to work.

If I understand the logic correctly, I can set a Min Subdiv to 0 and a Max Subdiv to 7, and that would add a 0 subdiv where its not necessary with much tesselation and a 7 subdiv where it needs it.

But I cant make it work.

Any ideas, tips?
I used Spatial, Fine, Subdiv Min/Max 0/7, Length: 0.1

Maybe this info doent make any sense, because you need to know how the geometry looks like?
Its a plane, witha noise displacement map. A circular mask makes the noise only visible in the middle.

I will attach an image, where I set Min/Max 4/7 and made look right, but you will see much tesselation on the planar area, where it shouldnt be much tesselation.

Or maybe there is a MR displacement shader??

As you can see, on the planar area, its not needed to be that much tesselated.
When I set subDuv to MinMax 0/7 or 1/7, the high-detailed area becomes very low-poly

09 September 2004, 10:28 PM

Maybe it's a SubD problem or the SubD approximation causing it to tesselate the whole object like that. I've attached an image showing a NURBS plane I just rendered that has a Bulge texture for displacement.

I didn't use any Surface Approximation, only Displacement Approximation set on Spatial, Fine, Min/Max 0/5 and Length on 0.25.

Try the same shader on NURBS and see what happens maybe.

09 September 2004, 11:03 PM
that is very usefuk to know, i was gonna try and comp it all.

Haider of Sweden
09 September 2004, 11:23 AM
Jozvex, thanx for your attachment, at least I know now that this works with nurbs.

I mean, I know that it should work this way, the logic of the Min/Max tells me it should end up like that.
Now, when you say that you only use Displacement Approximation, its logical, since NURBS has a great "built-in" surface approximation. The surface is mathematicly correct all the time. Or, I should rather say, its built mathematicly.

However, when you work with polys, you are not that lucky. So, I thought I was lucky when I discovered the SubDiv approx. because that turns you poly to a subdiv that has the same advantages as NURBS.

Now, do you have any clue why the SubD Approx isnt work?
I did even test with a normal SubD object and with the same shader + a tesselation approx, but it didnt work.

Haider of Sweden
09 September 2004, 11:56 AM
Thanx JozvexAt least, I know that it works with NURBS

Why do you think it doesn work with SubD? I even tested with a original SubD without luck :(

09 September 2004, 10:17 PM
Well, I suddenly just realised what it might be! When you render Maya's SubD objects in Mental Ray, you have to collapse them and make sure they are either all quad polys or all triangles.

So if you used SubD Approximation and then tried to get different amounts of tesselation in different areas, that would surely cause triangles or quads that Mental Ray won't maybe that's why it just subdivides the whole thing, to keep the faces the same.



Haider of Sweden
09 September 2004, 09:14 AM
Hi Joz

Nope, it wasnt any quad or tri problem. But your idea made me test around more, and I found that Spatial doesnt work for the SubD Approximation (if you're working on a poly-modell).
I had to use Length/Distance/Angle to make it work.

However, thank you for the wire-frame-tip, that helps a lot to see a visual proof of the MinMax effect while rendering.

Later, I would like to experiment with Displace approx toghether with the SubD Approx.; maybe this combination can speed up things?

CGTalk Moderation
01 January 2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.