Nodes/WAS Node Suite v3/Three Depth Of Field
ComfyUI Node Runs on cloud

Three Depth Of Field

Real lens blur on a 3D render, tuned in scene units

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Three Depth Of Field
  • input
  • effects
focus10.0
aperture0.0002
max_blur0.010

A 3D render without depth of field can look too perfect - everything pin sharp, no sense of a lens having been there. Three Depth Of Field blurs everything nearer and further than one chosen distance, the way a real camera does, and it's what turns a clean product render into a shot. Chain it into the effects socket on Three App, alongside or after a bloom, and the scene suddenly has a focal plane you can point at the subject.

The physics are expressed in plain scene units, which is the whole usability win here. focus is the distance from the camera that stays sharp. Camera nine units back from an object at the origin? Set focus to 9.0 and the object is crisp. The other two dials shape the falloff: aperture is how fast the blur comes on either side of the focus - and it's genuinely lens-like, so the numbers are tiny. 0.0002 is a gentle portrait-tripod look; 0.01 is a shallow wide-open lens where most of the frame dissolves. max_blur caps how far the blur is allowed to run - 0.01 is soft, 0.05 is a wash that melts the background into colour.

The effect chain deserves one reminder: this is a post-processing pass, and the moment any effect is in the chain, Three App's built-in antialiasing switches off. If you combine depth of field with bloom, end the chain with Three Antialias or your out-of-focus areas will show every stair-step edge on top of the blur. The input socket takes the effect before this one; the effects output hands the whole chain to the next effect or to App's effects socket.

One trap that catches people: focus is a number, not a picker, and it has to match your real camera distance in scene units. If you move the camera node and forget to update it, your subject quietly slips out of focus and you'll blame the renderer for what is really a stale number. Do the two-node dance first - put the camera where you want it, read off its distance to the subject, set that as focus - and the rest is taste.

Installing it

Part of WAS Node Suite v3. Install via ComfyUI Manager (search WAS Node Suite v3) or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

Restart; needs ComfyUI 0.14.0+ / Python 3.10+. Nothing installs or downloads. If the Three menu's missing, set features.threejs: true in <ComfyUI user dir>/was-node-suite/config.yaml.

If it looks wrong

Everything blurry usually means focus doesn't match the actual camera distance - double-check it after moving the camera. Nothing blurry with a huge aperture means the effect isn't in the chain at all. And when the blur looks crunchy rather than creamy, that's missing antialias at the end of the chain, not the aperture.

CategoryWAS Suite/Three

Inputs (4)

NameTypeDefaultDescription
focusFLOAT10.00–10000Distance from the camera that stays sharp, in scene units. 10.0 for a camera 10 units from its subject.
apertureFLOAT0.00020–0.05How fast the blur comes on either side of the focus. 0.0002 is gentle, 0.01 is a shallow portrait lens.
max_blurFLOAT0.0100–0.2How far the blur is allowed to go. 0.01 is soft, 0.05 is a wash.
inputoptTHREE_EFFECTThe effect before this one, if any. Left unwired this is the first pass after the scene is drawn.

Outputs (1)

NameTypeDescription
effectsTHREE_EFFECTThe chain so far, for the next effect or for Three App's effects socket.