Sunday, March 27, 2011

Creating custom UV pass in MR and using it in Nuke

That's a mouthful.
On a job recently I got some secondhand Nuke goodness when a lighting TD showed me how they were using UV passes from Maya to "auto-track" some footage into their shots (I wasn't on that job). The basic issue was that a lot of footage had to go onto screens in the spot and some of that footage wasn't ready or the client was changing their mind about what the footage should be. So, in short, any manual trick to the get the footage locked onto the CG screens required redoing some additional work in post, in terms of tracking, etc. Additionally, sometimes late notes were coming in about animation changes to the screens themselves, which meant that there was no option to render "in-camera" in Maya, it had be done in post.
 So the simple solution was to render the screens with properly adjusted UV's as UV passes. This automatically locked the footage in place and wasn't dependent on any additional work once the comp was built, even if the footage had to be completely replaced or the animation of the screen itself changed. Pretty sweet. While I'm sure some people think this is obvious, I didn't (and neither did a lot of the other people I was working with. So I'm not the only ignorant one.)
In any event, I also realized that I never really followed up on any render pass stuff in Maya 2010/11, so the first vid below is basically what we're trying to do and how to get custom color passes out of Mental Ray (as opposed to the "regular" passes that are pre-set, like reflection, diffuse, etc). I use this method to get out RGB matte passes and a UV pass in EXR format.
The second video is how to actually use the UV pass in Nuke to get the basic effect we're looking for. Nothing crazy, just basic use of the UV pass.

Maya/Mental Ray: Custom Color Passes (2010) Part 1 - UV Pass from zeth willie on Vimeo.

Maya/Mental Ray: Custom Color Passes (2010) Part 2 - UV Pass from zeth willie on Vimeo.


  1. In your "Custom Color Passes" tutorial you speak about the problem with the artifacts in the UV (ST) pass from Maya. I believe the a problem is that you should not be anti-aliasing the UV pass, you need to make sure to render the pass "unfiltered" or aliased. When you then use this pass in Nuke you must use a Matrix (3x3) node on the result (the footage on your "screen" as in your tutorial), the matrix node will anti-alias the result in post.

    In the matrix node: the 'matrix' attribute needs to have a value of...
    0, 1, 0
    1, 2, 1
    0, 1, 0
    and 'normalize' turned on

  2. very very useful tip, DavC! I'll do another quick post to clarify this (I've been planning on doing something about aliasing in the future, as well). I figured it was the anti-aliasing, but I've never used the matrix filter before (though I'm slightly, barely familiar with the Photoshop Custom Filter matrix, which I'm guessing is roughly the same thing.)
    Thanks for taking the time to share the info!


  3. Thanks for sharing the knowledge to everybody.

    I was able to do this in nuke but i m having big time problem in after effects. i m using RE:Map plugin from revisionfx in after effects.

    could you help on this too..
    there are several issues like 16bit /32 bit, image being mapped pixelated or uv being stretched .

    This would be a great help Thanks.

  4. hi, you rock !!!
    Great sharing of knowledge.

    BTW its working in ae too.

    but there are still some more stuffs to explore .. it's a bit tricky-tacky tickling.

    a big thanks again for all the post and not just this uv..