Maya Mental Ray Proxies tutorial: let's render billions of polygons!

Mental Ray proxies in Maya Tutorial

Maya integrates a Mental Ray feature that makes you able to render billions of polygons. It's an easy and very effective way to populate your 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: Rendering Maya, render Mental Ray

STATUS: Avaible since 05 April 2013



Mental Ray Proxies Tutorial for Maya

mental ray proxies maya tutorial

INTRODUCING MENTAL RAY PROXIES FOR MAYA

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.

3d olive tree for maya


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.

mental ray proxy tree in maya center proxy in maya viewport


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).

export proxies in maya maya mental ray export


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!

mental ray export options exported mental ray proxies from maya

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.

maya simple plane for proxies


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″

activate mental ray in maya assign mental ray renderer in maya activate maya mental ray bsp2 option


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.

maya simple proxy cube connect mental ray proxy in maya mental ray proxy 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 ?!

activate mental ray sun & sky in Maya render mental ray proxies in maya mental ray proxies render memory consumption

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.

mental ray proxies instanced in maya


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!


CONCLUSIONS

mental ray proxies maya tutorial

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!

maya proxies total memory consumption


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, we love you".




Maya Mental Ray Proxies Tutorial

 

Comments   

 
0 #1 malka16 2013-03-13 15:04
when can we expect this tutor
Quote
 
 
0 #2 Antonio Bosi 2013-03-14 14:30
Hi Malka, I think it should be avaible since the end of this month. Thanks god I've a lot of work these days, but I'll try to find some free time! stay tuned ;-)
Quote
 
 
0 #3 Antonio Bosi 2013-04-06 14:27
Quoting malka16:
when can we expect this tutor


Tutorial up malka16
Quote
 
 
0 #4 Lucas 2013-07-05 19:01
thanks for the tutorial! couldn't you create a custom paint effects brush in maya to create the instances?
Quote
 
 
0 #5 Antonio Bosi 2013-07-05 23:02
Quoting Lucas:
thanks for the tutorial! couldn't you create a custom paint effects brush in maya to create the instances?


Hi Lucas, I couldn't use maya paint effects because it doesn't make instances. Paint-fx create procedural generated geometry, that uses a huge ammount of memory. You can't populate complex scenes just using pfx brush, anyway its a good idea to use instances, proxies and pfx togheter to achive more interesting results.
Quote
 
 
0 #6 Maciek 2013-09-06 00:05
Hi Antonio,

It's great tutorial, but I have a problem.

When I import my proxy object to an empty scene then everything is fine, but when I do this to a scene that I working on, my tree disappears. It's a big exterior scene with Physical Sun and Sky with default options. I can't figure why that happens.

I will be grateful for help!
Quote
 
 
0 #7 Antonio Bosi 2013-09-06 07:01
Hi Maciek, when your proxie disappear?when you assign it to the mesh or when you hit render?

Have you tried to create the tree proxy in an empty scene, save that scene in mb format then import that scene in your exterior scene? Maybe it could work.
Quote
 
 
0 #8 Maciek 2013-09-06 10:39
Thank you for quick answer :)

I have imported the mb scene with proxy and it works good. With low quality render it is small difference, so it certainly will helps me later :)

But there is other difference. When I import scene with proxy object it has different lighting than when I import scene with tree object. Here is what it looks (tree on the right is an proxy object):
https://www.dropbox.com/s/jpql93qr3g6bilh/example.jpeg

Thanks in advance :)
Quote
 
 
0 #9 Antonio Bosi 2013-09-06 10:48
I think it's something related to texture's color management. Do you have activated it in render options? Try to disable/enable it or change the color management attribute from the texture node (form linear to srgb or viceversa). Let me know ;-) )
Quote
 
 
+1 #10 Maciek 2013-09-06 11:07
Right, I forgot about it! :)

Thank you for the help and of course I'm waiting for new tutorials :)
Quote
 
 
+1 #11 Jaykill 2013-10-07 07:20
Great tutorial !

I'm a 3D student and I've been looking for so long a clean and simple tutorial which will allow me to easily manage forest and fields renders within Maya.

Looks like I found it !

So, a huge thank you :)
Quote
 
 
0 #12 Antonio Bosi 2013-10-07 14:03
Thx Jaykill! Stay tuned, I'm going to release a related tutorial soon.... ;-)
Quote
 
 
+1 #13 del 2014-01-02 01:10
bro thank you for this. sincerely
Quote
 
 
0 #14 Claudio 2014-01-07 07:14
Thanks for your tips, they are really usefull, I like the grass you get in your renders, can you give us any tips on how to get a grass like that. Tanks in advance for any help.
Quote
 
 
+2 #15 Antonio Bosi 2014-01-07 10:53
Hi Claudio, making grass in maya is something that depens alot from viewing angles. In this case we have an high-angle view so I decided to use a normal map + displacement and some real 3d grass chunks. Hope it helps!
Antonio
Quote
 
 
0 #16 Claudio 2014-01-07 14:28
Thanks Antonio, again your comments are helpfull.
Quote
 
 
0 #17 Uro 2014-01-30 06:10
8) Bookmarked! MR proxies saved me.
Quote
 
 
0 #18 aupupup 2014-02-18 11:56
how to render passes ?
Quote
 
 
0 #19 Antonio Bosi 2014-02-18 18:34
Quoting aupupup:
how to render passes ?


Hi, unfortunatly I don't think that MR proxies are able to render out separate passes...
Quote
 
 
0 #20 aupupup 2014-02-19 05:12
Quoting Antonio Bosi:
Quoting aupupup:
how to render passes ?


Hi, unfortunatly I don't think that MR proxies are able to render out separate passes...


so do you know how to replace multiple proxies i can replace 1 by 1 but its waste my time, thanks
Quote
 
 
+1 #21 Antonio Bosi 2014-02-19 12:07
You could try Replace Object command (in the modify menu)...it should work fine
Quote
 
 
0 #22 Dan 2014-04-25 01:59
Hey there! I've followed all of the instructions to a "T". I still can't get this to work. My cube resizes, so I know Maya is getting the proxy information. I was getting a bounding box error, but that was resolved. When I render, I can see the ground plane, but otherwise there is nothing. No cube, no proxy, nothing. I really need to get this to work for a job interview, so can someone please help me out? Thanks!
Quote
 
 
0 #23 Hafiizh 2014-04-28 09:06
Actually MR proxies can be rendered in passes.

http://www.tokeru.com/t/bin/view/Maya/MayaMentalRay#Proxies

I think he covers everything about MR proxies.

Follow the "::" tip. It works.
Quote
 
 
0 #24 ravi kumar 2014-04-29 07:14
what if we refer proxies with controls that are moved. we have a system in place where we have referenced assets that are moved using their controls. These are swapped with their proxiy cubes with same cubes while they progress towards render. This is a better approach in terms of scene file loading. But for rendering is this a better approach or do you feel that instancing could further reduce memory load instead..
Quote
 
 
0 #25 Dan 2014-04-29 08:51
Quoting Hafiizh:
Actually MR proxies can be rendered in passes.

http://www.tokeru.com/t/bin/view/Maya/MayaMentalRay#Proxies

I think he covers everything about MR proxies.

Follow the "::" tip. It works.


Thanks! I'm having bounding box issues that are sporatic. I'm starting to think that Maya doesn't like my GPU. -Dan
Quote
 
 
0 #26 Antonio Bosi 2014-04-29 08:56
Quoting Hafiizh:
Actually MR proxies can be rendered in passes.

http://www.tokeru.com/t/bin/view/Maya/MayaMentalRay#Proxies

I think he covers everything about MR proxies.

Follow the "::" tip. It works.


Very interesting link, I'll add the tokerus's extra tricks in this article so the people will be able to find everything about proxies in a single page! Thx for posting
Quote
 
 
0 #27 Antonio Bosi 2014-04-29 09:01
Quoting Dan:
Hey there! I've followed all of the instructions to a "T". I still can't get this to work. My cube resizes, so I know Maya is getting the proxy information. I was getting a bounding box error, but that was resolved. When I render, I can see the ground plane, but otherwise there is nothing. No cube, no proxy, nothing. I really need to get this to work for a job interview, so can someone please help me out? Thanks!


Hi Dan, sorry for the late response but I was out of home/work these days. You could try to send me your scene with the proper proxy file (.mi and .mb)...I could do a sort of debug to see what is wrong.
Quote
 
 
0 #28 Antonio Bosi 2014-04-29 09:20
Quoting ravi kumar:
what if we refer proxies with controls that are moved. we have a system in place where we have referenced assets that are moved using their controls. These are swapped with their proxiy cubes with same cubes while they progress towards render. This is a better approach in terms of scene file loading. But for rendering is this a better approach or do you feel that instancing could further reduce memory load instead..


In this case I think using proxies or using instancies is equal.

Proxies has far better performance in terms of scene loading (as you said) and has other advantages when you need to replace/modify your referenced assets. For example you just need to modify your objects only one time to see them updated on all your proxies in the main scene. Using normal instancing technique you have to manually replace every single object with the new ones.

Anyway in terms of render performance (render time, memory consumption) I think proxies and instances are almost the same!
Quote
 
 
0 #29 Hafiizh 2014-04-29 21:37
The trick is Maya Particle Instancer

I try to avoid instancing as much as i can because maya instance is really slow to load because of the shadingEngine connections. Any scene with a few thousand instances would take >15min to load. Instead I would use maya particle instancer for the proxies. Any animation done would be on the particle expression.

The thing about mental ray is, once a ray hit the bounding box of a particle instancer, it will load all the instances in the particle. It's okay if you have a few thousands particle, but if the particle count is more than let say 100k, it would take more time to convert this particle instancer from maya to mental ray.

To speed things up, I would separate the particles into regions of 5k-10k particles so mental ray would not load everything all at once.

I did a whole town vegetation with hills and what not. 10 type of about 2 million poly trees with 2 million proxies. I break up the particles into few hundred patches. Then, depending on the camera, I would animate the visibility of unseen patches. A frame would take around 30m to 2 hours depending on cam angle. (on a 16 cpu 24gb ram)

The whole setup took half day. Of course these are not done by hand. I've written a few scripts to populate the vegetation with particle and break surfaces into patches. I think CreativeCrash has a few scripts on particle instancer. And now with maya XGen I think this would be much easier(?). But since we haven't upgraded I pretty much stuck with my own script. Here's an old demo. http://www.youtube.com/watch?v=Qx1DH2R6Hz8
Quote
 
 
0 #30 rafael 2014-06-20 15:31
hi, I have followed the tutorial, and had success with the proxy.
But what is the work around when I want to add a depth and ao pass to the proxy?

Thanks!
Quote
 
 
0 #31 Antonio Bosi 2014-06-20 15:56
Quoting rafael:
hi, I have followed the tutorial, and had success with the proxy.
But what is the work around when I want to add a depth and ao pass to the proxy?

Thanks!


You have to use a little trick explained here:
http://www.tokeru.com/t/bin/view/Maya/MayaMentalRay#Proxies
Quote