<< Home
If you have ever had problems with Mental Ray not tessellating how you want I hope this clears things up a bit. I didn't notice a problem until I started rendering things larger and with trim surfaces. After some research I found that mental ray has it's own tessellation section and not only can you make things look better, but you can have much more control over speed. If you don't know much about tessellationg yet you may want to do some reading first because I am assuming that you know how to use the advanced tessellation section for individual surfaces using maya. As of yet Maya has not integrating the tessellation options into the attribute editor not is it called tessellation. It is called the mental ray Approximation Editor. There are a few down sides to the approximation editor. You can not display render tessellation so you have to make educated guesses to know what will happen when you make a change. The other downside is that you can't change the surface approximation of more than one object at the same time Even if they are almost identical. The upside is that you have more control. You CAN change the tessellation of many objects at once, but unless your scene is made of almost all the same type of surface then you will want to avoid doing that unless you just don't have time to assign approximations to each surface. In case you are like me and sometimes Don't have time to approximate each surface here is how you can set approximations for all surfaces at once: |
||||
|
||||
The override section will override All surfaces to be tessellate in a certain way except for the displacement nodes: note though, that a surface with displacement actually gets tessellated twice. First he surface has a calculation, then the displacement map is added to it. Not having complete control over the two for an individual object would, in some cases, just be silly. So, we have The approximation Editor. Find it here: |
||||
|
||||
OK, now for the harder parts. What do all these options mean in the surface approximation nodes? I'll do my best to explain them. Approximation Presets: These are killer starting points for you to use that you may, or may not, have to tweak to get your desired surface. This is what they do: |
||||
|
||||
Someone brought to my attention that Alias has made it very difficult to change a surface approximation node after it is created. In fact, from the render globals you can't change it. It seems that you must create another node every time a change is made. DON'T Do that. Here is how to find the node: Open the outliner Thanks Karl, for bringing that little Maya mistake to my attention.
|
||||
Approximations Method: This is where the computer figures out when and where to subdivide, and how many times. |
||||
|
||||
Approximations Styles: This is how the triangles will actually be arranged using the method you choose. |
||||
|
||||
UV Subdivisions: This is available with the Parametric and Regular Parametric methods. This tells the computer how many times each surface, or patch respectively will be subdivided in their respective U and V directions. Remember Parametric method is the patch value, and Regular Parametric is the entire surface UV value.
|
||||
Min, Max Subdivisions: Available when using Length/Distance/Angle method. It controls the min and max number of times a triangle is subdivided. I wouldn't use a max value too much higher than 3 if you could help it. Each subdivision increases the number of triangles by four times each time you raise the number.
|
||||
Grading: This applies only to the delaunay style. I just noticed a bug as well. If you select an approximation method, then change the approximation style, the settings don't change unless you change approximation methods and then switch back. You will see what I mean if you do this: Select the spatial approximation method with grid style. Switch it to delaunay and you notice no difference. Grading only works with Delaunay style. Now change approximation methods and switch back to Spatial again. Notice that the change now takes effect. You can now select grading as a method. Grading uses a gradation to smooth out the effect of changing from dense triangles to not so dense triangles. I wouldn't use a value past 15 or 20. It really doesn't have much good effect after there. You'll have to experiment with that to find values that work for your surface.
|
||||
Sharp: This is mostly pertaining to displacement. It uses a value from 0 - 1. 0 being rounded edges and 1 being sharp. Use higher values when trying to create sharp displacements. Use a small number if your map has too much contrast for the effect you wanted.
|
||||
That's it. That explains all, or at least what I know, of the attributes there. Once you have created several approximation methods you can easily reuse them for each surface to fix the tessellation. Here is the actual tutorial part. It's real simple, and I don't use displacement in this exercise. This issue probably comes up a lot if you us mental ray to render with trim surfaces. You can download the scene at the bottom of the page if you want to follow along. The image below is
a typical trimmed surface. I used the round tool to round the edges of
a square, and pokes some holes in it. The square is flat on all sides
in this case just because I wanted something quick to show. As you can see some
of the surfaces are clearly similar. The 8 rounds on the corners, the
12 edges, the three circular fillets connecting the holes, the 6 flat
sides of the cube, the cylinder, and the part of the sphere at the top.
That leaves only 6 approximations we actually have to make. First things
first, I have not made the flat sides of the cube 1st degree surfaces.
So I will rebuild them to be such. That will dramatically cut down on
the tessellation. I did one test render to first make sure that this was
a case where Maya tessellation was insufficient. This is what you may
see. (click to take a closer look) The main problems are the corners. If this were the only angle we were going to see this object at, then we could eliminate a few things like the lower back corner, bottom, the two back sides, and the back and lower back edges. This would also cut down on render time. There would be a problem with bounced light if you wanted to use final gather, shown, or global illumination. If you weren't trying to fool anyone into thinking it was a photo though, no one would notice. Note: If you want to use the scene remember, to make rendering faster rebuild the six flat surfaces to be 1st degree. OK, so let's start fixing this stuff. Pull up the approximation editor: Windows>Rendering Editors>Mental Ray>Approximation Editor. You can just leave that up for the rest of the tutorial. It doesn't take that much screen space. I'm going to start with one of the corners first because they seem to be the worst in the test rendered image. First, select the
object you want to tessellate, and click create. Notice that there are no presets for the trim curve approximation. Since this is a static object that won't be bouncing around I will use Regular Parametric because this is a rather simple object that can easily be calculated in my head. There should be the same number of tessellation per span of the corner as the corresponding edge of the rounded edges of the box. That way there will be no visible holes. Let's figure that out. Find out which attribute, U or V, is the curved side of the edges. This should be easy because one should have say 3 spans, and one should have 1 span. In my case here it is 7u and 1v. So I know that U is the curved edge. I am going to use 4 U subdivisions and 1 V subdivision. for the edges. Because of this I should use 4,4 for the corners. The corners share all three edges of the NURBS surface with the edge of the rounded edges of the cube. As you should know NURBS surfaces can not have 3 sides. If you made a boundary then all points of one side are collected to a single point, so it only looks as if there are three sides. The same thing is happened to a sphere. Two sides are actually the top and bottom sections brought to a single point. The other two edges meet together. Let's look to see if we had any problems with the tessellation in those areas now. I just found another bug in this program. If you name a tessellation to make it easier to find it does not refresh. You have to close the window completely and reopen it. Maya actually gives you an error, * node does not exist. If that happens, just close the window and open it again. Now that I named my
surface approximations for the two objects I can assign them easier to
the other similar objects. My second guess was 1,16 (U,V). The number of the corner still stayed the same at 8,8 just to see if the tessellation would line up. Sure enough, it lined up fine. You might ask, "Why did Andy (that's me) double the V parameter, but not the U parameter. That surface is really only degree 3 in one direction The other direction needs no further subdivisions because it has no bend. The corners, however, bend in both U and V direction which is why both U and V need to be subdivided. Remember that flat surfaces need no subdivisions. That can save lots of render time; especially if you make one object and then decide to make an array of a thousand of them, or make it part of a particle system. If you were rendering only this object then you would more than likely use a preset to save yourself time. The amount of extra time spent rendering would not amount to the time fooling around with each separate approximation. Now that the edges and corners are fairly smooth I will worry about the divot on the top. You can notice a circle of evil black dots and lines around the bottom half of the round there. This should be easy to get rid of. My first idea was to try out the edge approximation I made on the round in the middle. You can see in the render below that it is missing. This is because the surface direction is the opposite. The easiest solution is just to switch surface directions and see if that works. I also tried the corner tessellation on the little half circle in the middle. That, I think, will work out fine. You can see the edge looks very smooth. You can also see that from this angle the top flat surface's inner ring seems to have some slightly rough tessellation. We will deal with that after the curved surfaces. Swapping the U and V directions worked and solved that problem, but what
was I thinking? The edge approximation is built for a degree 3, degree
1 surface. This surface is a 3,3 degree surface. That is why this next
render looks like it does. I took the liberty of adding the edge tessellation to the cylinder through the middle, since a cylinder has a 3,1 degree surface. In some cases, remember, that you may have to swap UV directions to make that work. Now, the image should look great like the one below. (by the way that is with 500 FG rays, not the initial 75) I also changed the floor to red. The one in the sample file uses Lambert1. Don't change that shader. Apply a new shader if you want to make changes to the floor.
If you notice anything that I missed please let me know, and I will add it with mention to you if you like. If I am just dead wrong about something then please let me know too. I do not want to mislead anyone. Please send questions, comments or suggestions about any of the tutorials to: |
||||
Sample file: Maya5 binary file |