Home · Lab · CG Multipass & Relighting

CG5 Depth defocus by layer

Defocus each depth layer, then merge

CG Multipass & Relighting · ~8 min · In pack $15

1 Your mission

~8 min

with the focus on the robot, bring the edge-band error below the goal in the panel (halfway between the two methods).

Compare the shoulders and head, left and right. Ask which image really holds the background behind the robot, and which layers need blurring at all.

SkyVFX Lab · CG5interactive · 1001

2 Why it works

At the robot’s edge, depth jumps from near to far. Defocus the merged image once and either the robot’s colour smears into the blurred background, or a blurred robot keeps a sharp outline.

Set the focus to “on the robot” and compare our result (left) with Blender’s real depth of field (right). Try both methods (“one defocus after the merge” and “defocus each layer, then merge”) and read each one’s edge-band error. The robot’s depth pass is premultiplied like its colour, so an edge pixel at alpha 0.5 holds about 4.8 m while the robot is at about 9.0 m: a distance where nothing exists. The “depth (merged)” view (brighter = nearer) shows the merged edge mixing the robot’s depth with the ground behind it.

CoC ∝ |z − focus| / z

Where the numbers come from: Every picture is a Blender 5.2 Cycles render of our own desert and robot, computed in your browser. The reference is a render of the plate and robot with Blender’s camera depth of field, at an aperture far wider than a real 35 mm lens (f/0.18) so the blur shows at 640 px (a teaching aperture). Our defocus is a teaching disc scatter sized by each pixel’s depth, not Nuke’s ZDefocus2, so neither method reaches zero; the score is the mean error in a band around the robot’s edge, and the goal is measured live when the images load.