A lot of After Effects compositors like to use a plugin to allow texture substitution on objects, called Re:Map. You render out a special color pass from your 3D scene, and then the plugin uses those colors to wrap a flat image onto the object, basically allowing you to re-texture in post.
A lot of people in the past have asked me or others to find the material you’re supposed to use to render this pass from Maya. There are different ways to make it, but by far the easiest is to just use a place2dTexture node and a surface shader (or a VrayLightMtl, if that’s your thing).
Connect the place2dTexture.outU –> surfaceShader.outColorR. Then connect place2dTexture.outV –> surfaceShader.outColorG.
That’s it. Apply the material to everything and you’re done. In VRay, you don’t even need a material if you want to save a render layer; just create a VrayExtraTex element on your render layer and connect the place2dTexture outputs to the ExtraTex element in the same manner.
The setup is really easy but there are a few things to watch out for. First of all, if your UV’s are distorted, then any texture you place on it is going to be distorted. So you need good UV’s. If you’re using simple rectangular billboards, make sure the UV’s are normalized (you can normalize UV’s in the UV Texture Editor). Also, the image quality will suffer if you aren’t rendering to a floating point file format– 32-bit floating point images are best to avoid artifacting.
One other subtle thing to watch out for. If you are using a linear workflow when you render (and you should be!) it’s easy to screw up this render and end up with weirdly warped images. This render should NOT be gamma-corrected in any way, so disable your lens shaders if you’re in mental ray, and set your gamma to 1.0 and turn off “linear workflow” if you’re in VRay. It’s hard to see, but take a look at the difference between a linear render of this pass and an sRGB (gamma 2.2) render:
The image on the left is the correct one. Using a color-corrected UV pass will cause your substituted textures in After Effects to appear very warped around certain edges.
(I’ve made this mistake way too many times.)