- Posted by Antonio
- Hits: 56691
Maya integrates one of the most important Mental Ray feature, that can make you render billions of polygons. It's an easy and very effective way to populate your Maya and Mental Ray scenes with thousands of objects like plants and trees without overload your system. Your CPU, your RAM and your girlfriend will thank you because of the time you can save with this trick!
TYPE: Free maya tutorial
CATEGORY: Render Maya tutorial, render Mental Ray tutorial
Today we are going to take a look at Proxy Objects in Mental Ray for Maya. Have you ever heard about v-ray proxies? Well, Mental ray and v-ray proxies are the same thing with different names. They are used to render an insane amount of polygons in a single scene. Mental Ray proxies are often used to render scenes with hundreds of high-resolution trees and vegetation in a very simple manner. Mental ray Proxy objects are used in many situations and can give you a lot of benefits in terms of memory usage and cpu load. They make your scenes lighter and faster at render, saving lot of memory usage during maya render process.
WHAT ARE MENTAL RAY PROXIES?
Mental Ray Proxy objects are like maya instances. Mental Ray Proxy objects don’t really exist in your scene, in fact you can't modify or edit them in your maya scene. Each mental ray proxy is loaded during render time (it' called "on demand") instead of simple meshes (like cubes) that you use to position proxies inside your scene, once you hit render that simple cubes are replaced by full detailed mesh.
The cool thing is that you can use a simple cube to represent a 2.000,000 tris polygon tree. This will allow you to populate your scene with hundreds of cubes (trees), without worrying about maya crashes or mental ray's out of memory errors. The maya renderer (Mental Ray) will manage these thousands of objects in a very performing way. The speed improvement will not be only in maya render process but also in your maya 3d viewport!
As we said one of the major benefit of proxy objects is that they are only loaded on demand at render time, just when they are absolutely needed for the render result. This can allow you to render much bigger scenes with the same amount of RAM on your PC: we are talking about BILLIONS of polygons rendered in less than 1GB of ram.
STEP 1: OPEN YOUR THE OBJECT YOU WANT TO BECOME A MENTAL RAY PROXY
Open with Maya a scene with the object you want to make a proxy of. In my case, it’s a polygon 3d Olive tree collection for Maya and Mental Ray taken from my 3d olives tree collection.
Be sure to setup shaders and textures properly. I advise you to combine everything in a single poly mesh to make mental ray optimize the proxy object.
Move that mesh to the grid origin (x 0 y 0 z 0) and freeze transformations.
As you can see it’s about 2 Millions of triangles poly mesh with complex shaders and textures, keep that in mind.
STEP 2: EXPORT PROXY OBJECT (the tree)
Select the poly mesh you want to export as a mental ray proxy object, then go to File>Export Selection and click on the small options box (Shown Below).
STEP 3: EXPORT SETTINGS FOR PROXY OBJECTS
In the Export window:
1) choose “Mental Ray” as “File Type”
2) choose “Render Proxy (Assembly)”as the “Export selection output” in the “File Type Specific Options” tab
Leave the other settings as they are. Now click Export Selection and give it a name to save.
Be happy, you have just created your first Mental Ray proxy object!
I've repeated this action for all of my 3 olea models.
STEP 4: CONNECT PROXY OBJECTS TO A POLY PRIMITIVE
Now open the maya scene you want to populate with Mental Ray proxy objects. I’ve created a poly plane with variations in height and a grass texture.
Be sure to activate Mental Ray for Maya:
1) Go to "windows" --> "settings/preferences" --> "plug-in manager" and activate mayatomr.mll
1) Choose “Render Using: Mental Ray”
2) In the “Quality” tab, under “Raytracing/ Acceleration” choose “BSP2″
Create a simple mesh (I advise you to use a Cube) and hit the folder icon next to “Render Proxy” in the “Mental Ray” tab of the mesh’s shape node. Search and connect your previously exported proxy object. The cube’s shape and position will change according to the proxy tree’s volume shape.
STEP 5: RENDER MENTAL RAY PROXIES
Let’s do a fast check: create a mental ray sun and sky node (under may mental ray render tab) and hit render.
You will see a tree instead of the cube... is it not great ?!
Mental ray told me:
current mem usage 431 MB, max mem usage 534 MB
triangle count (including retessellation) : 2206884
Now you are ready to populate your scene with your cubes (trees) and make a little woods just copying and instancing that initial cube. The tree which I showed you is about 2.000.000 triangles, so if you use ten of that trees and a couple of other detailed models, you can easily get a few million polygons. By keeping such high poly objects as proxy objects, you can easily navigate in your scene and include the full resolution models of your main objects.
STEP 6: CREATE YOUR LITTLE FOREST
You can adopt two main ways to create copies of your trees: copying and instancing. Instancing is very good way to save memory but sometimes it could be difficult to change proportions and scale of your proxy objects. I advise you to use both that methods in conjunction. Don't forget to rotate and scale your "cubes" to avoid noticeable repetitions.
STEP 6.1: INSTANCING/SCATTERING OBJECTS IN MAYA
Here's one of the weakest point of Maya: Autodesk have never developed an easy tool to make us able to scatter objects in a fast and realiable way.
We (poor maya users) can't benefit from the power of 3d Studio's awesome scattering plug-ins like Forest Pro.
What can we do then? Right now our choices are:
1) Manually scatter/scale/rotate/manipulate objects around the scene
2) Buy a Maya scatter plug-in like "Ninja Mesh" or others
3) Create an instancer particle node.
4) Pray god to wake autodesk about scattering limitations.
Any of these choices have pros and cons. I still haven't found the "final solution" for this problem. We'll discuss deeply in a next to come tutorial:
Scattering objects in Maya.
MENTAL RAY PROXIES LIMITATIONS:
Right now Mental Ray proxies seem to be a little "experimental", I know, they were introduced many years ago but they still have limitations and bugs. The main limitation is that Mental Ray Proxies doesn't support multipass render. This can be very limitating in a professional render pipeline. If you don't care about that (I care 50-50) you are safe....even if you don't discover a new mental ray proxies bug!
This render consists of about 200 visible instances of the mental ray proxy tree, for a total of about 400.000.000 rendered polygons. What about the memory consumption? Take a look at the maya render log window... as I promised mental ray did an excelent job!
Make a little comparsion copying 10 or 20 of these trees in the "traditional way", now look what happen when you hit render....
After that you'll be ready to say with me: "Mental Ray Proxies, I love you".