5.2 KiB
uid |
---|
urp-post-processing-depth-of-field |
Depth Of Field
The Depth Of Field component applies a depth of field effect, which simulates the focus properties of a camera lens. In real life, a camera can only focus sharply on an object at a specific distance. Objects nearer or farther from the camera are out of focus. The blurring gives a visual cue about an object’s distance, and introduces “bokeh”, which refers to visual artifacts that appear around bright areas of the image as they fall out of focus. To read more about bokeh, refer to the Wikipedia article on Bokeh.
The Universal Render Pipeline (URP) has two depth of field modes:
-
Gaussian: this mode approximates camera-like effects, but doesn’t imitate them completely. It has a limited blur radius and only does far-field blurring. This mode is the fastest, and is the best mode for lower-end platforms.
-
Bokeh: a slower but higher quality mode that closely imitates the effects of a real-life camera. It can do both near & far-field blurring, and generates bokeh on areas with high luminosity intensity, also known as hot spots.
Using Depth Of Field
Depth Of Field uses the Volume system, so to enable and modify Depth Of Field properties, you must add a Depth Of Field override to a Volume in your scene. To add Depth Of Field to a Volume:
- In the Scene or Hierarchy view, select a GameObject that contains a Volume component to view it in the Inspector.
- In the Inspector, navigate to Add Override > Post-processing, and click on Depth Of Field. Universal Render Pipeline applies Depth Of Field to any Camera this Volume affects.
Properties
Property | Description |
---|---|
Mode | Use this drop-down to select the mode that URP uses to set the focus for the depth of field effect.
|
Gaussian Depth of Field
Property | Description |
---|---|
Start | Set the distance from the Camera at which the far field starts blurring. |
End | Set the distance from the Camera at which the far field blur reaches its maximum blur radius. |
Max Radius | Set the maximum radius the far blur can reach. The default value is 1. Note: Values above 1 can cause visual under-sampling artifacts to appear in your scene. If your blur effects are not smooth or appear to have static noise in them, try decreasing the value back to 1 or lower. |
High Quality Sampling | Use higher quality sampling to reduce flickering and improve the overall blur smoothness. This can cause some performance cost. |
Bokeh Depth of Field
The Bokeh Depth of Field mode closely imitates the effect of a real-life camera. For this reason, the settings are based on real-life camera settings, and offer a number of properties to adjust the diaphragm blades on the Camera. For an introduction to diaphragm blades and how they affect the visual quality of your Camera output, refer to Improve Photography’s guide Aperture Blades: How many is best?.