Difference between revisions of "Depth of field"

From Second Life Wiki
Jump to navigation Jump to search
m (Text replacement - "hg.secondlife.com" to "bitbucket.org/lindenlab")
 
(48 intermediate revisions by 6 users not shown)
Line 2: Line 2:
== What is "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.''' It simulates the [http://en.wikipedia.org/wiki/Depth_of_field real-world optical effect with the same name], where a lens' focused area appears sharp, while what's further away is progressively blurrier. This can be used to creatively draw attention to a scene's focal point, and can also be aesthetically pleasing because of how our eyes naturally see. DOF is already used in many popular games DOF's creative possibilities are appealing to artists like photographers and machinimatographers.
'''Depth of field ("DOF" for short) is a graphics feature''' introduced to the experimental Second Life "Mesh Import Project" Viewer in late November 2010, then [http://community.secondlife.com/t5/Featured-News/New-SL-Viewer-with-Improved-Search-and-Real-Time-Shadows/ba-p/927463 supported in the main SL Viewer in June 2011]. 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.


Here are some example videos from Residents:
DOF simulates the [http://en.wikipedia.org/wiki/Depth_of_field 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 inworld depth of field effect is modeled after a 35mm camera with a focal length of 50mm.


: {{KBvideo|Y-AK3t_sqe4|640|385|type=youtube}}
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.
 
: [[File:5878186462_c561e3c9bd_o.jpg|640px]]
 
== How can I see the depth of field effect? ==
 
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 [http://secondlife.com/support/system-requirements/ System Recommendations].


: {{KBvideo|41zDmAZxlZU|640|385|type=youtube}}
In the main SL Viewer in Advanced mode:


: {{KBvideo|hsFLVBG3ykE|640|385|type=youtube}}
# Select '''Me''' menu > '''Preferences'''.
# In the {{win|Preferences}} window, click '''Graphics''' tab.
# Set the '''Quality and speed''' slider to '''Ultra'''.


== How can I see the depth of field effect? ==
Or, if you want to be more selective:


{{KBwarning|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.}}
# While you're still in the '''Graphics''' tab, click '''Advanced''' button.
# Check '''Lighting and Shadows''', which is a prerequisite.
# You can now check '''Depth of Field'''.


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 [http://secondlife.com/support/system-requirements/ System Recommendations].
{{KBwarning|DOF is still a new-ish feature, and like other advanced graphics features, are subject to change. Furthermore, their rendered appearance may differ and hopefully improve from version to version.}}


With that in mind, this video tutorial shows you the following steps:
This video tutorial has older steps that are no longer relevant, but the principles are still the same:


: {{KBvideo|OOHFNywu22I|640|385|type=youtube}}
: {{KBvideo|OOHFNywu22I|640|385|type=youtube}}
# Download and install the newest '''Mesh Development Latest Build''' (as of 2010-12-02, build "2.4.0 (215872)"; the "Mesh Import Project Viewer" doesn't yet have DOF) from [[Linden_Lab_Official:Alternate_Viewers|this page]].
# 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 {{k|Ctrl|Shift|G}} on the login screen and choose <code>Agni</code> from the dropdown menu.
# Choose '''Me''' menu > '''Preferences'''.
# In the {{win|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).
# Set '''Shadows''' to '''Sun/Moon''' or '''Sun/Moon + Projectors''', or it may be hard to see the effect.


== How do I customize my DOF settings? ==
== How do I customize my DOF settings? ==
Line 40: Line 40:
The settings are:
The settings are:


* '''CameraCoC''' - Camera [http://en.wikipedia.org/wiki/Circle_of_confusion circle of confusion] for DoF effect (in millimeters)
* '''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.
* '''CameraFNumber''' - Camera [http://en.wikipedia.org/wiki/F_number f-number] value for DoF effect
* '''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.
* '''CameraFocalLength''' - Camera [http://en.wikipedia.org/wiki/Focal_length focal length] for DoF effect (in millimeters)
* '''CameraFNumber''' - "Camera [http://en.wikipedia.org/wiki/F_number 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 [http://en.wikipedia.org/wiki/Focal_length 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. [http://en.wikipedia.org/wiki/Hyperfocal_distance Learn more about hyperfocal distance].
 
* '''CameraFocusTransitionTime''' - How many seconds it takes the camera to transition between focal distances.


For example:
For example:
# Set '''CameraFocalLength''' to <code>200.000</code>.
#{{k|Alt}}-click on your avatar to center that point and give it focus, and observe distant objects.
== How do I get tilt-shift effects? ==
[http://en.wikipedia.org/wiki/Tilt_shift Tilt-shift photography] is popularly used for simulating miniature scenes. Try these settings:
* '''CameraAspectRatio''' = <code>1.5</code>
* '''CameraFieldOfView''' = <code>60</code>
* '''CameraFNumber''' = <code>2</code>
* '''CameraFocalLength''' = <code>1000</code>
Want a more drastic effect? Raise '''CameraFieldOfView''' to something like <code>120.000</code>.
Defocused area too blurry? Raise '''CameraFNumber'''.
After June 2011, [[Torley]] habitually learned to keep the {{win|Debug Settings}} window open while adjusting '''CameraFNumber''' as needed, depending on distance to subject. Some 3rd-party viewers provide more direct access to these controls.
And remember to {{k|Alt}}-click to focus. It helps to use the keyboard camera shortcuts if you want the focused area to be non-centered. (Otherwise, crop the image in post-processing.) Your end result can be awesome like this (whee! Look at the little doll people):
: [[File:5880959179_19a0ba0610_o.jpg|640px]]
== Torley's preferred settings (as of May 2012) ==
These are optimized for big bokeh, favoring strength over subtlety. Requires a fairly powerful graphics card, or performance will suffer:
Preparation:
# Tap '''Ctrl-0''' 4-6 times to zoom in and narrow the field of view, creating a more intimate relationship with the tightly-focused subject matter.
# Select '''Advanced''' menu > '''Debug Settings'''.
# Set '''RenderVolumeLODFactor''' = <code>8</code> or even <code>16</code>, although that may be overkill. This makes it so curves don't look jaggy when zoomed up close.
# As-needed, set '''RenderAvatarLODFactor''' = <code>8</code> or another high value too.
And the specific DoF settings:
* '''CameraAspectRatio''' = <code>1.5</code>
* '''CameraFieldOfView''' = <code>10</code>
** Higher is more blur, although you'll need to vary this depending on the subject's size and your camera's distance from it.
* '''CameraFNumber''' = <code>3</code>
** Again, vary this to taste. Lower is more blur.
* '''CameraFocalLength''' = <code>250</code>
** Makes it easier to get up-close and personal with the subject without fuzzing out.
** This may vary depending on the scope of the scene, sometimes a higher length like <code>1000</code> is desirable.
* '''CameraMaxCoF''' = <code>20</code>
** Boosted from the default of <code>10</code>, a good balance.
* '''CameraDoFResScale''' = <code>0.250</code>
Example:
: [[File:DoF_2012-05-02.jpg|640px]]


# Set '''CameraCoC''' to <code>0.010</code>.
== [[Photo_checklist|Torley's even newer settings]] ==
#{{k|Alt}}-click somewhere in your Viewer window to center that point and give it focus.


== See also ==
== See also ==


* 2010-12-02 - '''[http://blogs.secondlife.com/community/community/tnt/blog/2010/12/02/tip-experimental-depth-of-field-camera-blur-effect Blog post pointing here]''' - By [[Torley|Torley Linden]].
* '''[[Lighting and shadows]]''' - Broader information about related advanced graphics features.
* 2010-11-30 - '''[http://nwn.blogs.com/nwn/2010/11/second-life-depth-of-field.html Coming Soon to Second Life (Maybe): Depth of Field]''' - From New World Notes.
 
* 2010-11-24 - '''[http://bit.ly/gKq3VD Tips on using DOF]''' - From Aki Shichiroji and others on SLUniverse.
* 2011-06-10 - '''[http://jumphearts.wordpress.com/2011/06/10/dof-mini-tutorial-mia%E2%80%99s-way/ DOF mini-tutorial]''' by Mia-Pow.
* 2010-11-24 - '''[http://hg.secondlife.com/mesh-development/changeset/2d5dc12d4385 DOF introduced into the Viewer code]''' - By Runitai Linden.
* 2010-12-04 - '''[http://lunajubilee.com/2010/12/04/bootcamp-depth-of-field/ BootCamp: Depth of Field]''' by Luna Jubilee and Express Zenovka.
* 2010-12-02 - '''[http://blogs.secondlife.com/community/community/tnt/blog/2010/12/02/tip-experimental-depth-of-field-camera-blur-effect Blog post pointing here]''' by [[Torley|Torley Linden]].
* 2010-11-30 - '''[http://nwn.blogs.com/nwn/2010/11/second-life-depth-of-field.html Coming Soon to Second Life (Maybe): Depth of Field]''' from New World Notes.
* 2010-11-30 - '''[https://lists.secondlife.com/pipermail/opensource-dev/2010-November/004711.html Further details]''' in a message sent by Nyx Linden to [[OpenSource-Dev]] mailing list.
* 2010-11-24 - '''[http://bit.ly/gKq3VD Tips on using DOF]''' from Aki Shichiroji and others on SLUniverse.
* 2010-11-24 - '''[http://bitbucket.org/lindenlab/mesh-development/changeset/2d5dc12d4385 DOF introduced into the Viewer code]''' by Runitai Linden.
 
=== Example videos from Residents ===
 
: {{KBvideo|Y-AK3t_sqe4|640|385|type=youtube}}
 
: {{KBvideo|41zDmAZxlZU|640|385|type=youtube}}
 
: {{KBvideo|hsFLVBG3ykE|640|385|type=youtube}}
 
: {{KBvideo|PKz81Q7mRGw|640|385|type=youtube}}
 
: {{KBvideo|C139ZBcKMQc|640|385|type=youtube}}

Latest revision as of 10:13, 1 May 2015

What is "depth of field"?

Depth of field ("DOF" for short) is a graphics feature introduced to the experimental Second Life "Mesh Import Project" Viewer in late November 2010, then supported in the main SL Viewer in June 2011. 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 inworld 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.

5878186462 c561e3c9bd o.jpg

How can I see the depth of field effect?

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.

In the main SL Viewer in Advanced mode:

  1. Select Me menu > Preferences.
  2. In the Preferences window, click Graphics tab.
  3. Set the Quality and speed slider to Ultra.

Or, if you want to be more selective:

  1. While you're still in the Graphics tab, click Advanced button.
  2. Check Lighting and Shadows, which is a prerequisite.
  3. You can now check Depth of Field.
KBwarning.png Warning: DOF is still a new-ish feature, and like other advanced graphics features, are subject to change. Furthermore, their rendered appearance may differ and hopefully improve from version to version.

This video tutorial has older steps that are no longer relevant, but the principles are still the same:

<videoflash type="youtube">OOHFNywu22I|640|385</videoflash>

How do I customize my DOF settings?

  1. Enable Advanced menu.
  2. Choose Advanced > Show Debug Settings.
  3. Enter a DOF setting (it autocompletes) and change its value.

The settings are:

  • 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.
  • CameraFocusTransitionTime - How many seconds it takes the camera to transition between focal distances.

For example:

  1. Set CameraFocalLength to 200.000.
  2. 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.5
  • CameraFieldOfView = 60
  • CameraFNumber = 2
  • CameraFocalLength = 1000

Want a more drastic effect? Raise CameraFieldOfView to something like 120.000.

Defocused area too blurry? Raise CameraFNumber.

After June 2011, Torley habitually learned to keep the Debug Settings window open while adjusting CameraFNumber as needed, depending on distance to subject. Some 3rd-party viewers provide more direct access to these controls.

And remember to Alt-click to focus. It helps to use the keyboard camera shortcuts if you want the focused area to be non-centered. (Otherwise, crop the image in post-processing.) Your end result can be awesome like this (whee! Look at the little doll people):

5880959179 19a0ba0610 o.jpg

Torley's preferred settings (as of May 2012)

These are optimized for big bokeh, favoring strength over subtlety. Requires a fairly powerful graphics card, or performance will suffer:

Preparation:

  1. Tap Ctrl-0 4-6 times to zoom in and narrow the field of view, creating a more intimate relationship with the tightly-focused subject matter.
  2. Select Advanced menu > Debug Settings.
  3. Set RenderVolumeLODFactor = 8 or even 16, although that may be overkill. This makes it so curves don't look jaggy when zoomed up close.
  4. As-needed, set RenderAvatarLODFactor = 8 or another high value too.

And the specific DoF settings:

  • CameraAspectRatio = 1.5
  • CameraFieldOfView = 10
    • Higher is more blur, although you'll need to vary this depending on the subject's size and your camera's distance from it.
  • CameraFNumber = 3
    • Again, vary this to taste. Lower is more blur.
  • CameraFocalLength = 250
    • Makes it easier to get up-close and personal with the subject without fuzzing out.
    • This may vary depending on the scope of the scene, sometimes a higher length like 1000 is desirable.
  • CameraMaxCoF = 20
    • Boosted from the default of 10, a good balance.
  • CameraDoFResScale = 0.250

Example:

DoF 2012-05-02.jpg

Torley's even newer settings

See also

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>
<videoflash type="youtube">PKz81Q7mRGw|640|385</videoflash>
<videoflash type="youtube">C139ZBcKMQc|640|385</videoflash>