I am a huge advocate of using shared render layers in a file referencing pipeline. It’s probably the only reasonable way of allowing lighters, animators, riggers and FX artists to work on shots and assets simultaneously. That being said, it isn’t without its weaknesses (many of which I talked about in anĀ earlier post). The latest one I encountered happens with scenes with TONS of objects… not necessarily a high polygon count, but just lots and lots of individual DAG nodes. Take a look…

When you share render layers between references, those render layers that come in with your references are still there. Maya just hides them, and knows to take the contents of each of your referenced layers and merge them with the matching non-referenced layer in your scene. What this means, in a dense scene, is an absolute shitload of new connections. This becomes apparent if you save a scene with shared render layers as a Maya ASCII file and open it up in a text editor:

createNode renderLayer -n "defaultRenderLayer";
	setAttr ".g" yes;
	setAttr ".rndr" no;
	setAttr -s 54 ".adjs";
	setAttr ".adjs[0].val" 1;
	setAttr ".adjs[1].val" 0;
	setAttr ".adjs[2].val" 1;
	setAttr ".adjs[3].val" 1;
	setAttr ".adjs[4].val" 1;
	setAttr ".adjs[5].val" 1;
	setAttr ".adjs[6].val" 1;
	setAttr ".adjs[7].val" 1;
	setAttr ".adjs[8].val" 1;
	setAttr ".adjs[9].val" 1;

Those adjustments are happening because all of your references have their own defaultRenderLayer, and Maya is making sure to add them all to your current scene’s defaultRenderLayer on the fly. This happens for every referenced node in your scene, for every shared render layer in your scene. So let’s say you are referencing twenty objects, each of them with about 100 individual pieces of geometry, and there are five shared render layers. 100 x 20 x 5 = 10,000 adjustments and 10,000 lines of code in your ASCII file. This means that things are going to translate SLOWLY. It will take forever to scrub the timeline, and even longer just to switch to another render layer, or to save the scene.

The only way around this, unfortunately, is to just reduce the number of objects in your scene. The best way to handle that is to start combining objects that have the same material. You typically don’t need every individual screw and bolt on your model to be separate from all the others… even if they are separate moving parts, you can combine groups of them or just skin them instead.

Remember that if you combine objects, they’re now component shaded! So don’t forget to fix those connections (this script will help). You’ll have to add the combined objects to your render layers again, too, and re-assign materials if necessary.

After I ran this on a scene that had many tens of thousands of nodes in it, my scene opening time went from nearly 15 minutes to 30 seconds. It’s definitely worth the effort.

Categories: Maya

Related Posts

Houdini

Alembic: from Maya to Houdini and back again.

As part of the pipeline I’m currently writing for Timber, I’ve been working on an input/output system that can pass data back and forth between Maya and Houdini. The goal is to have a Maya Read more…

Maya

automated path substitution in maya.

I’m trying to build a system right now that can automatically substitute environment variables for paths on a per-scene basis. When a user opens a Maya file, I want to parse that file and set Read more…

Maya

blanking the viewport in maya

A while ago I posted about how to manage viewports in Maya in order to prevent the screen from redrawing while doing a bake or Alembic export, which slows things down considerably. It turns out Read more…