visualization Dynamite VSP civil visualisation engineering 3ds max Autodesk viz mx civil3d inroads rail visualisation geopak 12d survcad astasoft pcplusplus symos geonius

News Feeds

Get the latest user blog posts delivered right to your desktop via our RSS or atom User Blog feeds.

Mental Ray Proxy System Script

Posted by Jamie Gwilliam on Friday 1st August 2008 at 10:36am  | Comments (0)

Just a quick note to make sure you aware of the script, Zap at Mental Images, produced for the MR proxy system found in 3ds Max (Design) 2009.

This enhances the already excellent MR proxy functionality by:

  • new Quad menu item “Convert Object(s) to Proxies”
  • retains material
  • retains child parent linkage
  • animation
  • replaces all instances of the original with the proxy, (save the file first)
  • Will even make you a cup of coffee

The script can be found here, but please note this is an unsupported tool but one which I have found extremely useful:

http://www.lysator.liu.se/~zap/ad/mental%20ray-mrProxyBake.mcr

What Are Mental Ray Proxies?

Well, technically, it’s a render-time demand-loaded piece of geometry. The particular implementation chosen for 3ds Max is in the form of a binary proxy. This means that the mental ray render geometry data is simply dumped to disk as a blob of bytes together with a bounding box. These bytes can then be read in… but not until a ray actually touches the bounding box!

Normally, geometry lives in the 3ds Max scene, and is then translated to mental ray data. So it means the object effectively lives twice in memory, once in 3ds Max, and once as the mental ray “counterpart”. Not only does the proxies remove the translation time, it actually removes the need for the object to exist in all it’s glory in 3ds Max; there is only a lightweight representation of the object in the scene, that can be displayed as a sparse point cloud so you can “sort of see what it is”, and work the scene at interactive rates. Not until the object is actually needed for render is it even loaded into memory, and when it is no longer needed, it can be unloaded again to make room for other data.

One neat feature with the proxies is that they can be animated

, i.e. mesh deformations can be stored (you can naturally just move the instances themselves around normally without having to save them as “animated” proxies, as a matter of fact, instance transformation is not baked into the file, only the deformations).

You can think of it as a point-cache on stereoids, because the entire mesh is actually saved - which means that topology changing animation (such as, say, a fluid sim) can be baked to proxies. Naturally, it’ll eat lots of disk ... but it’s possible. The animation can be re-timed and ping-pong’ed (so you can make, say, swaying trees more easily).

Making Proxies

Now, creating proxies in the shipping 3ds Max 2009 is a bit of a multi-step process. I wrote a little script to simplify that, but it wasn’t ready in time to make it into the shipping 2009, so you can find it here:

  • Download mental ray-mrProxyMake.mcr
  • Launch max, and on the MaxScript menu choose “Run Script” and pick the file. By doing this, it should now have installed itself.
  • Now open your “Customize” memory, the “Customize User Interface”
  • Choose the “Quads” tab
  • On the left, choose the category “mental ray”
  • In the list that appears, you’ll find a “Convert Object(s) to mental ray Proxy”. Make sure the one with the plural “s” on “Object(s)”, if you find one without s it is the shipping one which is not so fun. wink
  • Drag it to a quad menu of your choice - done!

Now you should be able to right-click an object, and get a “Convert Object(s) to mental ray Proxy” option.

This allows you to convert an object and replace the original with a mr Proxy. Note this removes your original, replaces it (and all it’s instances) with the proxy. It retains all transformation animation, children and parent links in all the instances. Now be aware your original is thrown away - do don’t do this on some file which you do not have a saved copy of your carefully crafted object!!!

You can also select multiple objects for baking to proxies. This, however, works slightly differently. Instead of just a filename, you are asked for a file prefix, and the actual object name in the scene is then appended to that name…. so if your prefix is “bob”, then “Sphere01” is saved as “bobSphere01.mib”.

Disclaimer

Now, this is an unsupported experimental tool. Be aware it will delete your original Object(s) - so save your original scene. It may have a gazillion of bugs, misfeatures, and may cause your computer to explode. There is no warranty that it’ll even execute. But if you find it useful…. enjoy. wink

Posted by Jamie Gwilliam on Friday 1st August 2008 at 10:36am

Comments

No comments have been posted for this entry yet.