Adobe After Effects has a very effective Camera Lens Blur effect that is capable of efficiently faking DOF (Depth Of Field) and Bokeh visual effects for 3D rendered images and animations, and also animate a fake “Focus-Pull”.
The effect will work best on 32 bit float EXR files, and requires a Z depth render element (pass/AOV) to be rendered with the main RGB image, and supplied as the Blur Map layer.
If necessary, color correct the Z depth image so that the Black to White range will reflect the wanted focus range, and that the closest depth will be Black, blending into White at the furthest depth.
Example of a Z Depth image:
Controls the blurriness
Choose the lens iris shape (number of blades) to design the Bokeh effect
Defines a black & White Depth Layer (Z Depth) where black is the closes point to the camera and white is the furthest.
Blur Focal Distance:
Values of 0.0 to 1.0 will have the black through grey to white areas of the Blur Map remain at focus (sharp)
Highlight > Gain:
Intensify the highlights to create a more dominant Bokeh effect
Select the 3D Camera layer and also Null layers if available.
Choose File > Scripts > Run Script File and locate the AE3D_Export script.
In the Script parameters highlight 3ds max.
Click Options and set the scale. * you might need to try and see the scale in 3ds max to set it right.
Set a name for the exported ms (MaxScript) file.
Click Export. The resulting MaxScript file will appear on the desktop named <your after effects project name>.ms Note: You may be prompted to check the Allow Scripts to Write Files and Access Network option in File > Preferences > Scripts & Expressions.
Drag the generated MaxScript file into the 3ds max viewport. The script will run and create an animated Camera and Dummy object, and also set the timeline range to fit the animation.
Create a new Point Helper object.
Align the new Point Helper to the Dummy object in both position and orientation.
Group the Camera and the Dummy objects together, and link the group to a new Point Helper. This will allow for easy orientation and scaling.
Set the Point Helper object’s rotation to default (0,0,0) , this will also reset the Dummy + Camera group’s orientation relative to the world. Scale the Point Helper object if needed, to scale the whole camera setup.
Display the original video sequence as viewport background to check how the camera motion fits the video. The center of your Point Helper should appear “glued” to a specific point in the background video.
Select the footage layer in the composition and choose: Animation > Track Camera. * A 3D Camera Tracker effect will be applied to the layer, tracking will be processed, and when finished tracking points will be displayed.
Hover over the tracking points and click to select a planar position, a location where the round icon is placed between 3 planar tracking points. * If you don’t see the tracking points make sure the 3D Camera Tracker effect is highlighted in the layer’s Effect Controls.
Apply an EXtractoR effect on the layer.
* Effects > 3D Channel > EXtractoR
In the EXtractoR effect parameters, Click the RGB Channels to open the EXtractoR dialog box.
Choose the wanted layer from the Layers drop-down, or select individual channels from the B, G, B, Alpha drop-downs.
The Layer will be displayed darker than the original EXR main layer display because it will not be Gamma corrected (linear display).
A Gamma correction should be applied on the result of the composite via an adjustment layer or ‘pre-comping’ the layers and applying it on the containing composition.
* A Gamma correction can be applied using a Levels effect.
* In most cases the Gamma correction need to be with a value of 2.2 (sRGB).