Nuke: projection mapping and baking textures 2018

Recently at work I’ve had a need for projecting images onto 3D models and baking the textures down for use in Unity. This led me to try a few different techniques for baking texture projections. I tried Maya’s native projection, Renderman and finally Nuke, which by far was the easiest and fastest of the three. Especially since we often needed to adjust the textures and re-project them.

I assume you already know how to export an obj for use in Nuke. So fire up Nuke, and let’s get started.

Setting up the nodes

Below is the nodes required to setup a projection in Nuke. Let’s go over it. First you read the image that you want to project. Connect this to a Project3D node, which needs an image input and a Camera node.

In the Camera node properties, you define it’s transition and rotation values that you can copy from your 3D software like Maya, or move the camera if you didn’t model from a photograph in the first place. Hit “tab” to switch between a 3D scene view and the default 2D view. In the Projection tab of the Camera node, you can specify the type of projection (like perspective), the focal length and the size of the film back. Again, these values can be found in Maya. For my scene, I use a standard 35 mm focal length and a film size of 36 mm by 24 mm.

The output of the Project3D is then connected to the img of a ReadGeo node, which just reads your OBJ file.

Finally, the ScanlineRender node receives the OBJ model with the image projected onto it, along with the same Camera used for the Project3D node.

Projection types

If all went well, you should see something like this if you connect the viewer to the ScanlineRender node.

Changing the projection type from perspective to UV for the ScanlineRender will give us the desired result and we only need to connect a Write node to output the model texture.