Thursday, July 16, 2009

Broken references, revisited.

Today's episode of Maya=FAIL is brought to you by the number 8.

I was called over to a lighter's desk today. One of the assets in her shot refused to allow itself to be added to a render layer. Closer inspect revealed that it was somehow named wrong. This particular asset was part of a numbered series: asset1, asset2, asset3, etc.. In this particular case, asset8 was in the shot, but the namespace was called asset9.

What?

Nowhere in our workflow do we change the name of an asset. I tracked through all other assets that made up the scene, and found a few lingering nodes related to asset9, probably from nodes that were imported then removed or renamed. Thinking that somehow, they were responsible, I cleaned up the assets in question, rebuilt the lighting scene and... nope, still there.

Where was asset9 coming from? There was no longer any asset9 in ANY of the maya files that comprised the scene!

Maya's automatic naming clash handling was somehow kicking in, erroneously, and renaming asset8's namespace to asset9 on a few nodes. That was causing connections to fail (silently, of course) and weirdness to ensue..

The solution? In the lighting sync scene (which is then referenced into the lighter's scene) I changed the namespace from "asset8" to "asset8A".

And now the lighting scene works. Why? No idea.

Hey Autodesk, if ending a namespace in a number can cause mysterious node renaming when those assets are later referenced, WHY is it even possible to do so?

FAIL.

Thursday, July 9, 2009

The fail that is render layers

Building a lighting pipeline for anything beyond simple CG characters is complex. Compositing wants specific layers, with secondary outputs of diffuse, specular, shadow, depth, uv, world position, and many, many others. Different layers need different shader assignments and different rendering attributes. Maya's solution to this appeared in Maya 7 and is called "Render Layers".

Render Layers works like this: there is one layer by default. It's a node, called defaultRenderLayer1. Confusingly, it ends up called "Master Layer" in the Render Layers window, but no matter. The Master Layer contains all geometry in the scene, the default settings. Now, if you create a new render layer and make it current, you can create a per-layer override for any attribute on any object.

"That sounds great!", I thought to myself. And merrily the lighters went about creating render layers, assigning different shaders and... wait, why won't that shader attach? What does that obscure error message mean? Why are all my shader assignments reset when I re-open my scene?

Turns out that Render Layers do not play well with references. Meaning, they don't work. They break. The only solution is to import all the references in your scene, cross your fingers, and hope that it all works in the ends.

In the pipeline for a large show, we often want to reuse work wherever possible. So, if we have a sequence with 30 or so nearly identical shots, we'd ideally like to reuse the lighting, layers, and per-layer overrides from a single shot (the "key" shot) as a starting point for all the other shots. So, of course, Aliasdesk must have included a simple way to export a render layer as a MEL script? Right? Right?

No.

FAIL!