Often, when working on a sequence in which multiple shots have similar camera angles, the CG background will only be rendered for one hero shot. The other shots will then re-use the same CG to save extra work and render time. Here is how to accurately align the CG background in shots where it is being re-used.
Import What You Need
To re-use the hero shot’s CG render in another shot you can make use of projections in Nuke. For that, you will need to import:
The hero shot’s CG render
The camera that the CG was rendered with
The geometry (if any)
The camera for the shot you are currently working on
The lens distortion for the shot you are currently working on
Pick A Reference Frame
If the hero shot’s CG render has multiple frames, pick a reference frame that closely matches the camera angle in your shot. Framehold the CG render on that frame. Also, Framehold the camera that the CG was rendered with on the same frame. This will be your projection camera.
(If the hero shot’s CG render only has one frame, just make sure to Framehold the camera that the CG was rendered with on the same frame).
Line Up The Projection Geometry
Should you have geometry matching the CG render, then great, you may be able to use that as-is. If not, you can create a point cloud from the CG render, and line up Cards, Cubes, or other Nuke geometry to it.
You can create a point cloud from the CG render by using a PositionToPoints node, setting the surface point to the position pass, and the surface normal to the normal pass. If you have Deep renders, you can use a DeepToPoints node and plug in your deep and camera to create a point cloud.
View the point cloud in 3D space and move your Cards or other geometry to line up with features such as walls, roofs, streets, etc. It’s important to make the Cards/geometry large enough so that they will catch all of the projection and not crop any of it.
Project The CG Render
Once you have the CG render and projection camera frameheld on the reference frame, and the projection geometry lined up and ready to go, project the CG render by using a Project3D node. If there is overscan in the render that you want to keep downstream, make sure to project the overscan properly.
Render The Projection
Next, connect a ScanlineRender node and use the camera from the current shot as the render camera. Finally, add the lens distortion from the current shot. The re-used CG background composited into your shot should now line up exactly with the hero shot.
The setup and general workflow.
💡 The same method applies for re-using a matte painting across a sequence.
I hope you found this tutorial useful. For more Nuke tips & tricks, see Nuke.