Quick Tip: MentalRay Proxies

Quick Tip: MentalRay Proxies

Tutorial Details
  • Software: Autodesk Maya
  • Difficulty: Beginner
  • Estimated Completion Time: 30 Minutes

Final Product What You'll Be Creating

In today’s quick tip, Dimitar Katerov will explain what proxy objects are, and how they can be used to render an insane amount of polygons in a single scene. If you’ve ever gone through the pain inducing task of trying to render a scene with a few hundred high-res tree models, then this quick tip may be the answer to your prayers! So fire up Maya and let’s get started!

Mental ray Proxy objects (assemblies) are used in many situations and give you a lot of benefits. They make your scenes lighter and faster, and save you a lot of memory during the rendering process. Proxy objects are basically like instances. One of the main differences (which is the easiest to spot), is that Proxy objects don’t exist in your scene. Each proxy is loaded during render time, and positioned in the spot you have determined by placing a simpler object (even just a cube). This way your scene has less polygons to deal with in your viewports. This makes life a lot easier, by not having to wait ten seconds each time you rotate your camera. For example, you can use a simple cube that consists of six polygons to represent a 500,000 polygon tree. Then populate your scene with hundreds of these cubes without any change in the viewport speed at all.

The second major benefit of proxy objects is that they are only loaded at render time, and only during the time they are needed. The memory is then flushed and filled with different data (another proxy object or anything else). This can allow you to render much bigger scenes with the same amount of RAM on your PC. This tutorial will show you the basic use of a proxy object, and the most important settings you need to know.

Step 1

Open a scene with the object you want to make a proxy of. In my case, it’s a tree. Which I will use to make a small forest.

Step 1 Image

Step 2

Select everything that you want to export as a mental ray proxy object (move it to grid origin if it isn’t already there). Then go to File>Export Selection and click on the small options box (Shown Below).

Step 2 Image

Step 3

In the Export window choose “MentalRay” as the “File Type”, and choose “MentalRay” in the “General Options” tab as well. Then choose “Render Proxy (Assembly)”as the “Export selection output” in the “File Type Specific Options” tab. Leave the other settings as they are and click Export Selection. Give your file a name and location to be saved in. This will automatically export your materials as well, so be sure to make your materials before exporting.

Step 3 Image

Step 4

Now we have a file which contains our proxy object. Create a Cube and hit the folder icon next to “Render Proxy” in the “Mental Ray” tab of the cube’s shape node. That way you connect your cube to your proxy object.

Step 4 Image

Step 5

Make sure that “Renderable” in the “pCube” section of the Attribute Editor is turned “on”, and also in the “Mental Ray” tab and in the “Render Proxy” tab as well. Now when you hit render (with mental ray assigned as the render engine) you will see the tree instead of the cube. Select the tree and delete it as you won’t need it anymore.

Now if you make an instance of this cube it will be represented in the render by the same tree. You can export another tree or anything else as a different proxy, and then populate your scene with your cubes or any other low poly objects. The tree which I showed you is 132,000 polygons, so if you use ten of those 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 5 Image

Step 6

Instead of just duplicating your Cube, go to Edit>Duplicate Special and click on the small “Options” box. Then click the “Instance” radio button and click “Duplicate Special” to confirm. Now you can just copy your cubes with the “Duplicate Special” shortcut ( Ctrl+Shift+D).

Step 6 Image

Step 7

Now you must make some adjustments to the render settings to make sure you are actually getting the benefits that render proxies can give you at render time.

Obviously choose “Render Using: Mental Ray” first. In the “Quality” tab, under “Raytracing/ Acceleration” choose “BSP2″. This will probably be automatically selected because you have proxy assemblies in your scene, but at least check to see if it’s set.

Step 7 Image

Step 8

In the “Features” tab choose “Raytracing” for the “Primary Renderer”. This is mandatory for your RAM to be able to be flushed, and to load only the necessary proxy objects, when using BSP2.

Step 8 Image

Step 9

Position your low poly objects where you want your proxy assemblies to be rendered (use different Scale and Rotation values to avoid noticeable repetition).

Step 9 Image

 

Conclusion

This render consists of a 700,000 polygon car, plus about 15 instances of the cube with the tree attached (15 x 130,000 polygons), or about two and a half million polygons, but is only increasing my system memory consumption by 250MB when I hit the render button. You can easily see how many more objects you can handle when using proxies.

Conclusion Image


Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.

  • Manfred

    Wow. Good tip! Simple yet very useful. Thanks very much!

  • Jeeva

    nice article.. some nice new tips.. thanks for that.. yet the problem is we cant use this technique when we take layer pass renderings… the reason is maya occlusion pass which wont render propely when we use proxy… have you tried it… if there is some solution pls update it.. it will be so helpful… thanks

  • Mauricio

    Good one,
    It’s always nice to remember old and great techniques. :D
    cheers

  • Jhon

    I discovered Mental RAy Proxies 15 days ago, and has made my life easier. It is a good tool. But If you need to interact with the objects in the proxies it is very difficult to do (or impossible) : i.e: if you need a squireel to jump from one tree to many others. because you can not see the tree’s strucutre.

    Besides this. Thanks.

    • suresh

      There is only only one solution for your question u need to build a proxy in the basic shape of tree. Then u can get an idea for squireel to hop on trees.

  • Some guy

    Will it save lighting rendering time?

    • sureshk

      Yeah it will reduce the ligting time. But few problems with these proxy’s are they won’t support light linking and shader tweaking according to the lights

  • NikieVFX

    These are great but I’m wondering if they found a work around yet for the render passes? Last time I tried this (in maya 2011) my proxies wouldn’t contribute to render passes. Anyone know a work around?

    • Dimitar Katerov

      Try to set your scene, with all passes and then export the proxy object. That should work just fine.

      • chrisRbernal

        Can you elaborate on this a bit.
        I’m in the same situation right now.

  • DImitar Katerov

    There will be a significant difference, if the proxies save enough RAM so you don’t need to use the swap file on your hard drive.

  • http://mjmurdock.com mjmurdock

    Awesome! I’ve been wanting to know this for a while!

  • Samuel Pereira

    Really great tut and yet I still have a question that keeps popping out, is there any significant difference between a mip_binaryproxy and an “exported proxy”?

    Thanks

  • http://onekastudios.com Charles

    That was ULTIMATE!

  • Mairajj

    i followed the steps…i made the tree from paint effects and converted it to polygons..exported and all…
    but when i render the scene it shows the tree but without any texture…plus this

    // Error: (mental ray) : keyakiLeaves.iff: can’t open file for reading (No such file or directory) //

    any suggestions?

  • http://www.sachin-animationmentor.com sachin soni

    This is showing texture error because once you export proxy and save it in same folder it doesn’t take texture path by default,,,, so what you need to do is choose option export file path in the bottom of export window and make all the paths “Absolute” that’s ur done….

    let me know if you have any other problems…….

  • saul

    i get this error and image comes out dark

    API 0.6 error 301099: C:/Users/asus/Desktop/projects/villa/proxymodels/2-test.mi, line 31: while defining texture “file47:tex”: failed to open texture file Arch31_043_leaf.jpg
    IMG 0.6 error 101003: Arch31_043_leaf.jpg: can’t open file for reading (No such file or directory)
    API 0.6 error 301105: C:/Users/asus/Desktop/projects/villa/proxymodels/2-test.mi, line 51: undefined color texture “3::file47:tex”
    API 0.6 error 301099: C:/Users/asus/Desktop/projects/villa/proxymodels/2-test.mi, line 96: while defining texture “file50:tex”: failed to open texture file Arch31_043_leaf-gray.jpg
    IMG 0.6 error 101003: Arch31_043_leaf-gray.jpg: can’t open file for reading (No such file or directory)
    API 0.6 error 301105: C:/Users/asus/Desktop/projects/villa/proxymodels/2-test.mi, line 116: undefined color texture “3::file50:tex”

  • saul

    so what you need to do is choose option export file path in the bottom of export window and make all the paths “Absolute” that’s ur done….
    let me know if you have any other problems…….

    i dont understand your instructions

  • http://safraz3d.tumblr.com/ safraz

    Hiya,

    Apologies but I cant get the proxies to render, I made a proxy as you said then when I tried a new scene, create a box, set the render proxy,have it at renderable, and render there is nothing rendered. :S

    Plus my proxy has render layers so I was hoping that would appear in the render layers but nothing happens.

    Regards~

  • mathilde

    Hey guys!

    I have a very big problem. When i follow the tutorial for a project, sometime the first object in proxy appears during the render, sometime no and when it appears I can’t move, rotate, scale or duplicate it.
    I use the classic transform mode and the duplicate special with instance.

    thank in advance for your help.

  • Artur

    Thnx man, very useful

  • arescet

    do you know a way to convert complex animated objects into proxies? i tried doing it but MR won’t read all the frames except frame 1 :(

  • Ad

    Can you tell me whats the difference between this method or setting layers to bounding box?