In this post I'm going to explain my methodology to merge different pictures or portions of an environment in order to create a panoramic image to be used for matte painting purposes. I'm not talking about creating equirectangular panoramas for 3D lighting, for that I use ptGui and there is not a better tool for it.
I'm talking about blending different images or footage (video) to create a seamless panoramic image ready to use in any 3D or 2D program. It can be composed using only 2 images or maybe 15, it doesn't matter.
This method is much more complicated and requires more human time than using ptGui or any other stitching software. But the power of this method is that you can use it with HDR footage recorded with a Blackmagic camera, for example.
The pictures that I'm using for this tutorial were taken with a nodal point base, but they are not calibrated or similar. In fact they don't need to be like that. Obviously taking pictures from a nodal point rotation base will help a lot, but the good thing of this technique is that you can use different angles taken from different positions and also using different focal and different film backs from various digital cameras.
- I'm using these 7 images taken from a bridge in Chiswick, West London. The resolution of the images is 7000px wide so I created a proxy version around 3000px wide.
- All the pictures were taken with same focal, same exposure and with the ISO and White Balance locked.
- We need to know some information about these pictures. In order to blend the images in to a panoramic image we need to know the focal length and the film back or sensor size.
- Connect a view meta data node to every single image to check this information. In this case I was the person who took the photos, so I know all of them have the same settings, but if you are not sure about the settings, check one by one.
- I can see that the focal length is 280/10 which means the images were taken using a 28mm lens.
- I don't see film back information but I do see the camera model, a Nikon D800. If I google the film back for this camera I see that the size is 35.9mm x 24mm.
- Create a camera node with the information of the film back and the focal length.
- At this point it would be a good idea to correct the lens distortion in your images. You can use a lens distortion node in Nuke if you shot a lens distortion grid, or just do eyeballing.
- In my case I'm using the great lens distortion tools in Adobe Lightroom, but this is only possible because I'm using stills. You should always shot lens distortion grids.
- Connect a card node to the image and remove all the subdivisions.
- Also deactivate the image aspect to have 1:1 cards. We will fix this later.
- Connect a transfer geo node to the card, and it's axis input to the camera.
- If we move the camera, the card is attached to it all the time.
- Now we are about to create a custom parameter to keep the card aligned to the camera all the time, with the correct focal length and film back. Even if we play with the camera parameters, the image will be updated automatically.
- In the transform geo parameters, RMB and select manage user knobs and add a floating point slider. Call it distance. Set the min to 0 and the max to 10
- This will allow us to place the card in space always relative to the camera.
- In the transform geo translate z press = to type an expression. write -distance
- Now if we play with the custom distance value it works.
- Now we have to refer to the film back and focal length so the card matches the camera information when it's moved or rotated.
- In the x scale of the transform geo node type this expression (input1.haperture/input1.focal)*distance and in the y scale type: (input1.vaperture/input1.focal)*distance being input1 the camera axis.
- Now if we play with the distance custom parameter everything is perfectly aligned.
- Create a group with the card, camera and transfer geo nodes.
- Remove the input2 and input3 and connect the input1 to the card instead of the camera.
- Go out of the group and connect it to the image. There are usually refreshing issues so cut the whole group node and paste it. This will fix the problem.
- Manage knobs here and pick the focal length and film back from the camera (just for checking purposes)
- Also pick the rotation from the camera and the distance from the transfer geo.
- Having these controls here we won't have to go inside of the group if we need to use them. And we will.
- Create a project 3D node and connect the camera to the camera input and the input1 to the input.
- Create a sitch node below the transfer geo node and connect the input1 to the project3D node.
- Add another custom control to the group parameters. Use the pulldown choice, call it mode and add two lines: card and project 3D.
- In the switch node add an expression: parent.mode
- Put the mode to project 3D.
- Add a sphere node, scale it big and connect it to the camera projector.
- You will se the image projected in the sphere instead of being rendered in a flat card.
Depending on your pipeline and your workflow you may want to use cards or projectors. At some point you will need both of them, so is nice to have quick controls to switch between them
In this tutorial we are going to use the card mode. For now leave it as card and remove the sphere.
- Set the camera in the viewport and lock it.
- Now you can zoom in and out without loosing the camera.
- Set the horizon line playing with the rotation.
- Copy and paste the camera projector group and set the horizon in the next image by doing the same than before; locking the camera and playing with camera rotation.
- Create a scene node and add both images. Check that all the images have an alpha channel. Auto alpha should be fine as long as the alpha is completely white.
- Look through the camera of the first camera projector and lock the viewport. Zoom out and start playing with the rotation and distance of the second camera projection until both images are perfectly blended.
- Repeat the process with every single image. Just do the same than before; look through the previous camera, lock it, zoom out and play with the controls of the next image until they are perfectly aligned.
- Create a camera node and call it shot camera.
- Create a scanline render node.
- Create a reformat node and type the format of your shot. In this case I'm using a super 35 format which means 1920x817
- Connect the obj/scene input of the scanline render to the scene node.
- Connect the camera input of the scanline render to the shot camera.
- Connect the reformat node to the bg input of the scanline render node.
- Look through the scanline render in 2D and you will see the panorama through the shot camera.
- Play with the rotation of the camera in order to place the panorama in the desired position.
That's it if you only need to see the panorama through the shot camera. But let's say you also need to project it in a 3D space.
- Create another scanline render node and change the projection mode to spherical. Connect it to the scene.
- Create a reformat node with an equirectangular format and connect it to the bg input of the scanline render. In this case I'm using a 4000x2000 format.
- Create a sphere node and connect it to the spherical scanline render. Put a mirror node in between to invert the normal of the sphere.
- Create another scanline render and connect it's camera input to the shot camera.
- Connect the bg input of the new scanline render to the shot reformat node (super 35).
- Connect the scn/obj of the new scanline render and connect it to the sphere node.
- That's all that you need.
- You can look through the scanline render in the 2D and 3D viewport. We got all the images projected in 3D and rendered through the shot camera.
You can download the sample scene here.