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.
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.
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).
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.
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.
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.
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).
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.
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.
Position your low poly objects where you want your proxy assemblies to be rendered (use different Scale and Rotation values to avoid noticeable repetition).
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.
Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.