Heaps of clones in 3DS Max with proxies

Play­ing around with a lot of meshes in Max is an easy way to crash it. The autosave fea­ture is put a lot to con­tri­bu­tion (viva autobak.max !). Same rou­tine for After Effects by the way…

In an under­go­ing project, we needed at some point an array of 96*16 (not a zil­lion) meshes, sim­ple ones as they are. So I hap­pily used the Array tool, cloning en masse. As Max started to cough, I saw a repet­i­tive pat­tern of the pre-crash effect. Noth­ing I could do to save him. And even when there was no crash, the UI was utterly slow.

Purokushi

I lookep up solu­tions about han­dling lots of meshes at once and I found mrProxy to be exactly what I needed. This arti­cle on cgso­ci­ety talks about the new fea­tures of Max 2010 and shows a lit­tle what you can do with mrProxy and huge forests in archi­tec­tural ren­ders. It is def­i­nitely a great thing like the Archi­tec­tural Mats and Pro Mats that the arti­cle men­tions. The thing is how­ever, prox­ies are noth­ing new. I don’t really know why they talk about it as a new fea­ture here. Per­haps the fact it is “new” is that it is shipped with Max…

If you’re on VRay, there are also vRayProx­ies but let’s talk about Men­tal Ray Prox­ies here.

Gen­er­ally speak­ing, a proxy is a kind of por­tal, a gate­way you must pass through in order to use some resource or pro­duce something.

In net­work­ing that’d be to use a con­nec­tion with the advan­tage of secu­rity and dis­ad­van­tage of slower speed depend­ing on where your proxy is phys­i­cally located.

In pro­gram­ming, a proxy is often thought as a design pat­tern and imple­mented as a com­mu­ni­ca­tor with some data source for instance, you don’t deal directly with the data source but use prox­ies instead.

Metal type models in typography

Metal type mod­els in the early print­ing, a proxy you can take in your hand !

In 3D, there are sev­eral kinds of prox­ies too. By default, Max has a bitmap proxy fea­ture in the ren­der­ing options but let’s talk about mrProxy which is here an object like any other you can use on your scene.

mrProxy is a tem­po­rary replace­ment for your mesh on the scene. That helps to save some pre­cious mem­ory that men­tal ray won’t feed upon, hun­gry as it is.

What the proxy does is, it rep­re­sents your model with a cloud of ver­tices, not too many so as not to slow the Max UI and you han­dle it in place of the real model. So you can repli­cate thou­sands or more instances of the mrProxy and Max is less of a slug.

Meshes, unite !

A few things to note. A Proxy by default doesn’t have the same mate­r­ial as the model, it doesn’t have any in fact. You might want to shift tex­tures from one proxy to another to make them look dif­fer­ent. Don’t worry about your uvw map­ping and mate­r­ial ids, they’re all work­ing as if it were the real model. So you can apply the same mate­r­ial from the model to the proxy with­out worries.

Now a very impor­tant thing : you can’t make a proxy out of a group or what­ever con­tainer it might be. That’s too bad and it will force you to clone your model and make it into one sin­gle mesh. For­tu­nately, Max han­dles the mate­r­ial ids pretty well.

Another thing you might won­der, prox­ies work with any kind of mesh, nurbs comprised.

So if for instance you have two multi-sub mate­ri­als, each made of sev­eral mate­ri­als, you’ll often have two series of mate­r­ial ids start­ing from 1. Let’s say you got a model of a human cyborg whose left arm is a robot, the rest is all weak human flesh. For some rea­sons, you have made the human as a poly and the robot arm as a nurbs. Either you’ll choose to make two prox­ies, for the body and arm, or you’ll con­vert the nurbs mesh to a poly mesh and attach it to the body.

Then you got a “human” multi-mat made of

  1. skin
  2. eyes
  3. mouth

And another multi-mat, say “cyborg”,

  1. shiny metal
  2. plas­tic

There’s obvi­ously a mate­r­ial id con­flict if you are to merge your meshes together.

If you’d want to make a sin­gle mesh out of all this, you’d first clone the whole joe, turn the poly into a mesh and attach the robot arm to the flesh body. Max in all his wis­dom would then ask you how you want to man­age the mate­r­ial ids, the first option is your best choice as it will reas­sign the mate­r­ial ids of, say, the robot arm so that the parts of the arm whose mate­r­ial ids are 1 don’t look like skin.

Here’s a sam­ple gen­gon in action with two mate­ri­als. The red ver­tices are the mul­ti­ple proxy clones.

Proxy model

Dol­lies

When your base mesh is ready, you only need to write it onto an exter­nal .mib file using this panel below.

To access it, you need to cre­ate a new mrProxy instance and place it on the scene.

Proxy panel

The mrProxy panel

After the file browser, you’re prompted with these parameters.

mrProxy write to file box

mrProxy write to file box

In still mode, you need to write only one tem­po­rary file that your proxy will refer to. If you want your proxy to repli­cate some kind of ani­ma­tion, you’ll need to write all the animation’s frames into tem­po­rary files. So yes, you’ll have to update your prox­ies if you decide to mod­ify the ani­ma­tion of the model.

Ver­tex and topol­ogy ani­ma­tions are sup­ported by mrProxy so that cov­ers most of your needs.

I observed a lit­tle prob­lem with the scal­ing of imported meshes. It doesn’t hap­pen all the time and is in fact quite rare but if you don’t see your proxy either in the UI or in the ren­der, it’s often because of a too low scale value in the proxy.

So here’s what it looks like, hav­ing many proxy instances of your mesh on the scene. Looks messy but at least it’s fast in the UI.

Proxy vertices cloud

Ver­tices cloud of your replicas

All this ren­ders at a decent speed, it’s a mat­ter of a few min­utes with the default men­tal ray params.

Proxies render

Ren­dered proxies

What’s more ?

A list of some scripts that might or might not help you on scriptspot.com

A nice util­ity called Proxy Painter on 3rdpole.com, it works both with VRay and Men­tal Ray.

A good intro to mrProxy is avail­able on hagerman.com.


About this entry