Depth of field
What is "depth of field"?
Depth of field ("DOF" for short) is an experimental graphics feature introduced to the Second Life "Mesh Import Project" Viewer in late November 2010. 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.
DOF simulates the real-world optical effect with the same name, 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.
DOF can be used to creatively draw attention to a scene's focal area, and is already used in many popular games. DOF's creative possibilities are appealing to artists like photographers and machinimatographers.
Here are some example videos from Residents:
- <videoflash type="youtube">Y-AK3t_sqe4|640|385</videoflash>
- <videoflash type="youtube">41zDmAZxlZU|640|385</videoflash>
- <videoflash type="youtube">hsFLVBG3ykE|640|385</videoflash>
How can I see the depth of field effect?
DOF is on by default with no ability to disable whenever Lighting and Shadows (including with Ambient Occlusion on) is enabled. If you don't see it, specific steps to enable and control it are below.
DOF and the other graphical effects that must be enabled to see it are collectively taxing, and are best enjoyed with a graphics card and computer system that significantly exceeds the System Recommendations.
Warning: DOF and other experimental graphics features are formally unsupported — meaning, don't count on them to work. Crashes and other system instability may result. Furthermore, these features are subject to change, and their rendered appearance may change from version to version. Feel free to share your findings with fellow enthusiasts, but otherwise, you're pretty much on your own. You should be comfortable tinkering with Second Life settings before going further. |
This video tutorial shows you the following steps:
- <videoflash type="youtube">OOHFNywu22I|640|385</videoflash>
- Download and install the a Mesh Development Build with DOF.
- If it's "2.4.0 (215872)" or higher, it should include DOF; the "Mesh Import Project Viewer" doesn't yet have DOF. Note that if there's no good latest build with DOF, you need to use an Old Build.
- Start the special Viewer and login.
- If you want to use DOF on the main grid, you'll need to change grids before logging in: press Ctrl+Shift ⇧+G on the login screen or check Show Grid Selection at login in Preferences' Advanced tab, then choose
Agni
from the dropdown menu.
- If you want to use DOF on the main grid, you'll need to change grids before logging in: press Ctrl+Shift ⇧+G on the login screen or check Show Grid Selection at login in Preferences' Advanced tab, then choose
- Choose Me menu > Preferences.
- In the Preferences window, click Graphics tab.
- You'll probably want to set the Quality and speed slider to Ultra.
- Click Advanced button to show additional options.
- Check Atmospheric shaders and Lighting and Shadows (if they aren't already enabled).
- To enhance DOF, check Ambient Occlusion and set Shadows to Sun/Moon or Sun/Moon + Projectors.
How do I customize my DOF settings?
- Enable Advanced menu.
- Choose Advanced > Show Debug Settings.
- Enter a DOF setting (it autocompletes) and change its value.
The settings are:
These have changed in newer builds (like 2.5.0 (216627) and higher), please update and cleanup
CameraCoC - "Camera circle of confusion for DoF effect (in millimeters)" 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.- CameraAspectRatio - "Camera aspect ratio for DoF effect" -- Set this to the aspect ratio of the camera you're modelling. For example, a 35mm camera has an aspect ratio of 3:2 (1.5). Second Life will use this as a frame of reference for how field of view and focal length must be adjusted depending on window size.
- CameraFieldOfView - "Vertical camera field of view for DoF effect (in degrees)" -- The default FoV for the camera you're trying to simulate. Second Life will use this as a frame of reference for adjusting focal length as the in-world field of view changes.
- CameraFNumber - "Camera f-number value for DoF effect" 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 f-number 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 - "Camera focal length for DoF effect (in millimeters)" 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 modeling and set CameraFocalLength to the focal length of that camera and leave it. Adjusting field of view will lengthen or shorten the simulated focal length appropriately to simulate the use of a zoom lens. Learn more about hyperfocal distance.
For example:
- Set CameraFocalLength to
200.000
. - Alt-click on your avatar to center that point and give it focus, and observe distant objects.
How do I get tilt-shift effects?
Tilt-shift photography is popularly used for simulating miniature scenes. Try these settings:
- CameraAspectRatio =
1.500
- CameraFieldOfView =
135.000
- CameraFNumber =
4.000
- CameraFocalLength =
1000.000
And remember to Alt-click to focus. Your end result can look like this.
See also
- 2010-12-04 - BootCamp: Depth of Field by Luna Jubilee and Express Zenovka.
- 2010-12-02 - Blog post pointing here by Torley Linden.
- 2010-11-30 - Coming Soon to Second Life (Maybe): Depth of Field from New World Notes.
- 2010-11-30 - Further details in a message sent by Nyx Linden to OpenSource-Dev mailing list.
- 2010-11-24 - Tips on using DOF from Aki Shichiroji and others on SLUniverse.
- 2010-11-24 - DOF introduced into the Viewer code by Runitai Linden.