mip_binaryproxy

david | mentalray,rendering,tutorials | Thursday, October 30th, 2008

I was looking through the "Whats New" section of the maya 2009 manual and read this about Render Proxies

Use render proxies with mental ray rendering to manage large scenes with complex geometry. Export your complex object as a mental ray assembly file, then replace it in your scene with a placeholder object that references this file. When you render, the exported object is loaded into memory and rendered with the rest of your scene. Translation time and memory usage are cut down, allowing mental ray for Maya to render large scenes.

And that prompted me to write about the mip_binaryproxy node. Those of us who are sticking with maya 2008 for the time being can use mip_binaryproxy to implement render proxies almost as easily as our friends with maya 2009.

mip_binaryproxy is one of several "production" shaders that are installed with maya 2008 but hidden by default. I'll assume you have already exposed them (look here if you haven't).

The mip_binaryproxy workflow is very simple, but some things need to be done in the correct order for them to work properly. So... here we go...

1. Start by creating your geometry. It has to be a single mesh polygonal object with no heirarchy and a single shader assigned. Obviously this is a big limitation. If you want to assign different materials to different parts of the object, then you will need to lay out uvs and prepare fileTextures accordingly.

2. Create a low resolution version version of your mesh to act as a stand-in. This could be as simple as a single polygon. The idea is that you will populate your scene with the low resolution stand-ins and at render time mentalray will replace them with copies of your high resolution mesh.

Here is an example

3. Create a mip_binaryproxy node, either by using the "Create mental ray Nodes" menu in the hypershade window or by typing this command

createNode "mip_binaryproxy";

4. Connect the mip_binaryproxy node to the low resolution objects transform node's geometry shader slot (you can drag and drop).

5. Open the mip_binaryproxy node in the attribute editor and enter the Object Filename. This is where a copy of your high resolution object will be stored in a special mentalray assembly format. It should have the file extension .mi

Check the "Write Geometry" flag, and for "Geometry" enter the name of your high resolution object's transform node.

This is an example of how mine looked

You must include the full path name in the "Object Filename".

6. Make sure your high resolution object is above your low resolution object in the outliner. And make sure it is visible.

7. Do a render. The rendered image is not important and you can make it low quality and tiny to do it quickly. The important thing is that the render writes out the assembly file that you specified in step 5.

8. Now uncheck "Write Geometry" in the mip_binaryproxy attributes.

9. And break the mip_binaryproxy "Geometry" connection, as shown here

This step is not mandatory but it will ensure you dont get any warnings about invalid instances.

So your mip_binaryproxy attributes should now look something like this

10. Hide (or delete) your high resolution object. It is no longer needed in the maya scene file, since it is now stored as an assembly file.

11. Populate your scene with copies of your low resolution object. It is important that each copy has a geometry shader connection to the mip_binaryproxy. The easiest way to do this is to use the "Duplicate Special" options as shown here

This will mean you have every object connected to the same copy of the mip_binaryproxy node.

When you populate the scene you can group the low resolution objects however you wish.

Here's a simple example

12. You can see from the last picture that I have assigned different shaders to copies of the low resolution object. These shader assignments are passed to the high resolution object at render time.

13. Render.

Here's my quick render test

Summary

It looks a bit convoluted when you first read about it, but is actually very easy and quick to set up once you get the hang of it. Populating a scene with low resolution stand-ins can make a dramatic difference in scene size and the scene becomes much easier to work with in maya. When rendering the scene load and translation time is greatly reduced. Some consideration must be given to working within the limits of this method, but for working with large numbers of objects the benefits will often make the extra preparation time worthwhile.

Credits

Much of what I have written here, I learned from reading cgtalk and lamrug. Here are two links for further reading...

http://forum.lamrug.org/viewtopic.php?f=6&t=1489

http://forums.cgsociety.org/archive/index.php/t-607924.html

19 Comments »

  1. hi have you checked your render times? with and without proxies? cause mine should be decreased due to using render proxy but in fact they have incresed... oh and im using maya 2009

    Comment by dire1 — November 12, 2008 @ 9:25 pm

  2. I cant comment on maya 2009, but I have had good results with 2008. I recently worked on a project where I populated a scene with approx 4000 objects. These were not super hires. only 150 polys per object. The lores object was a simple cube with 5 polys. A render with final gather and ambient occlusion lit by mia_physicalsky (but no reflections) came in at only 2 minutes per frame on a quad core.

    But its not really the render time that makes this an attractive method. The scene size was MUCH smaller with mip_binaryproxy, so it loaded very quickly and translation at render time also much quicker and better memory usage.

    The thing is that maya doesnt like large numbers of dag nodes, so 4000 of anything will be slower, but with lo res proxys populating the scene it was much more manageable.

    Oneday when I get to try 2009, I'll have to do a comparison.

    Comment by david — November 12, 2008 @ 11:23 pm

  3. ok i made a scene with 14xAudi R8 (2mln polys) . the proxy is 2 secs faster :)
    but when i make a simplier scene like yours here i get a different result.
    im aware of the advantages like smaller scenes and better memory usage which are great cause when i made 50 Audis my scene crashed or i couldnt save it at all...

    another thing is that u can use those render proxies like blocks in ACAD.
    i mean it might me helpful if u have many exact objects and u need to change all of them
    in the same way. u just modify your proxy and export it to the existing file. am i right?

    i think my expectations were too big about those rendering times bacause my friend who uses vray told me proxies do a great job in decreasing render time.

    Comment by dire1 — November 13, 2008 @ 1:31 am

  4. Thanks for letting us share your experience. And I agree about being able to easily update with a new proxy. In that sense its like referencing.

    Comment by david — November 13, 2008 @ 8:32 am

  5. As always, nice work david
    I want to know why you don't use Instance for populating the low res?
    I know that copy eat a lot of memory !
    So what is the best way, Instance or Parent? or are you using parent just to get different Shader?
    best regards
    /rachid

    Comment by rachid — November 18, 2008 @ 1:47 am

  6. Hi rachid, you can use instance if you prefer. In the past I have had some problems with instancing and mentalray, resulting in very slow scene translation at render time. I think these bugs were fixed in maya 2008, but I have been cautious about using them still. And I have done only minimal testing of instances and mip_binaryproxy together.

    If you do some tests I would be pleased if you would drop back and let us know your experiences.

    Comment by david — November 18, 2008 @ 11:26 pm

  7. Yes I've instanced 2500 objects with the volleyball and the clay, I can go up, but 2500 just to answer to this question posted here:
    http://www.mymentalray.com/forum/showthread.php?t=2116
    In maya2009 you can export the .mi file as ASCII, so you have ability to do some modification on it !
    I've noticed that when you create an object with multi textures on it, you must create a default set by selecting one of the Component ( face, edge, or vertex, etc...) without the set you get a black render with nothing!
    You can also export multi objects at once, say you have in the scene a lot of objects
    a cube, a sphere, a torus, etc...
    so select all the faces for the cube and create a set, do your UV, apply different textures ..
    Do the same things with the others objects, so the idea is: each object must have a set.
    Finally combine all the objects, delete the history and freeze the transformations and export as Render Proxy [Assembly]
    then put the combined object in to the layer and make it invisible or just hid it
    the rest is to load the .mi file in a cube, instance many times you want until you rich the limit!
    best regards
    /rachid

    Comment by rachid — November 19, 2008 @ 12:19 am

  8. cool men

    Comment by dican — January 19, 2009 @ 1:06 pm

  9. I made test with your technique and it works great. Managed to render 18 billion (18000 objects x 1 million polys), but it can be done more (seems almost infinite). Render time is super fast, at low settings final gather and render completed in 20 seconds.
    My question is this, since I am not so skilled in node connection: can I first copy proxy objects (for example cube) and AFTER that connect them all at once to mip_binaryproxy node?

    Here are images of proxy test (this is sample tree from archmodels)
    http://www.shrani.si/f/2l/99/44PFVibi/proxy-test-18g-poligonov.jpg
    http://www.shrani.si/f/17/Xj/4oKsMwZM/proxy-test-18g-poligonov.jpg

    Comment by igi — March 10, 2009 @ 8:32 am

  10. Wow! That's a lot of polys. I'm amazed.

    You can hook up the mip_binaryproxy after duplicating your proxy objects. This would be best done using some mel to loop through your objects, since there are so many.

    So, you would select all your proxy objects and then enter these 2 lines in the script editor. (mipBP is the name of my existing mip_binaryproxy node, so change this to suite your scene)

    string $sel[] = `ls -sl`;
    for($s in $sel) connectAttr -f mipBP.outValue ($s+".miGeoShader");

    Comment by david — March 10, 2009 @ 10:31 pm

  11. btw, had to unhide the mip shaders (AGAIN) on 2009, noticed the customNodeClass mel uses an optionvar now, so no mel hacking required. Just type

    optionVar -iv "MIP_SHD_EXPOSE" 1

    save prefs, restart maya, shaders are now all there, even placed in correct shader categories.

    Comment by matt — June 4, 2009 @ 8:17 pm

  12. Thanks for the tip matt. It's certainly easier that way.

    Comment by david — June 4, 2009 @ 11:30 pm

  13. yep. also on the connecting-lots-things side, i'm using multitude manager more and more. handy script by andrew chapman that lets you set attrs, select stuff, do lots of repetitive things with a minimum of fuss, and build a nice preset library as you go. Would make quick work of wiring up many objects to a single binaryproxy, or even many binaryproxies.

    http://www.technolumiere.com/software/multitudeManager.html

    Comment by matt — June 5, 2009 @ 2:39 am

  14. Nice one matt. I haven't actually tried it yet, but I love the idea of running a little bit of mel from the UI. It will make it so much easier when running those little snippets looped code that are too specific to make a permanent script from.

    Comment by david — June 6, 2009 @ 12:32 am

  15. when i hide the "hi-res" the uv's and maping dosn't show. i can see only the "low poly" shading.
    what i did wrong? btway thanks for the great tut.

    Comment by gofer — June 20, 2012 @ 4:01 pm

  16. Maybe I dont understand your question. You hide the hires and you only see the low poly in the viewport. Only at render time the low poly should be replaced - but only in the renderer, not in the viewport.
    What version of maya are you using? This tute was written on maya 2008. I think the binary proxy workflow may have changed in more recent versions. Maybe someone who has experience with a newer version can comment. (I switched to vray so I've lost touch with the more recent mentalray developments.)

    Comment by david — June 20, 2012 @ 11:38 pm

  17. i'm using maya 2009, and what i see when i take render it's the material that igave to the low poly object.(happen only when i shot down the "hi_res" object).
    i will send you my project file.

    Comment by gofer — June 21, 2012 @ 11:25 pm

  18. hello david
    when ihave multiply file texture for exmample tree with leaf tex and trunk tex?
    how can i connect this filse to one lowpoly object?

    Comment by gofer — June 23, 2012 @ 12:24 am

  19. As I said before, I have not touched this stuff for at least 3 years now. If you look back through the previous comments, there is one by rachid that discusses something similar to what you are asking I think. He posted a link to the mymentalray forum. You may be able to find the answers you are looking for there.

    Comment by david — June 24, 2012 @ 2:19 pm

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck