Depth of Field

From Second Life Wiki
Jump to navigation Jump to search

Overview

The mesh viewer recently introduced a Depth of Field effect that has been getting quite a bit of attention from SL photographers. This page aims to explain what the effect does, how it might change in the future, and what debug settings control it and what they mean.

Concept

Depth of Field is a photographic effect caused by a lens focusing on a particular subject. There are two planes to consider -- a near focal plane and a far focal plane. When an object is between the far focal plane and near focal plane, it is considered to be in-focus. The human eye is subject to depth of field, but because the field of view of Second Life is more similar to a camera, the in-world depth of field effect is modeled after a 35mm camera with a focal length of 50mm.

Enabling Effect

The effect is on by default with no ability to disable whenever "lighting and shadows" and "ambient occlusion" are enabled.

Controls

Three debug settings control the placement of the near and far focal planes:

  • CameraCoC - circle of confusion
  • CameraFNumber - f-stop
  • CameraFocalLength - focal length

CameraCoC

The most misunderstood value, a "circle of confusion" can be thought of as a constant that describes the resolution of a particular image. Currently, the viewer uses 0.05 everywhere, which seems to be a good approximation for 1080p. 35mm film has a typical CoC of 0.03. Image size, subject distance, lighting, etc. can all affect CoC, but for the purposes of the Second Life approximation of depth of field, a larger CoC will cause the near and far focal planes to be further apart (more forgiving of what's "in focus") and a smaller CoC will cause the planes to be closer together (less forgiving about what's "in focus"). In general, you should set this to a constant number for a given resolution and leave it.

CameraFNumber

This is a simulated f-stop as you'd see on a camera with and adjustable aperture. A typical 35mm lens might have a range of f/2 to f/22. The smaller the number, the wider the aperture. In general, a smaller fnumber will result in a narrower depth of field. When trying to tune depth of field for a particular image, this is the number to modify.

CameraFocalLength

Different cameras have different focal lengths (the distance from the outer camera lens to the film). In general, a shorter focal length will result in a closer hyperfocal plane -- that is, the subject distance at which the far focal plane approaches infinity. You should choose what kind of camera you're modelling and set CameraFocalLength to the focal length of that camera and leave it. Second Life will assume you're using a camera with a 90 degree field of view at that focal length. Adjusting field of view will lengthen or shorten the simulated focal length appropriately to simulate the use of a zoom lens.

Suggested Reading