Gallery
Physically Based Auto Depth of Field
Share
Explore
Physically Based Auto Depth of Field

icon picker
Features

Create-your-own Camera and Volume Presets
Full Tooltips and Comments throughout
with
Non-Destructive Workflow
Extended on known unity Workflows and Systems.
Lightweight with no GC and <0.1% CPU utilisation

DEPTH OF FIELD

Depth of field is calculated by 2 main parts of the
@HD Camera

Aperture

Controls the depth or shallowness of the effect.
Lower numbers like f2.8 gives a Shallow Depth of Field (a much thinner plane of focus)
the Blue you see in debug view
everything else gets blurry outside of that plane
The Red you see in debug view
Higher numbers like f22 give a Deep Depth of Field (a large plane of focus where much more is in focus)
Loading…

Focal Length

By its physical nature, depending on the focal length of your lens you can achieve a different DoF even if you're focused on the same spot at the same distance.
For example:
a 24mm lens at f4
has a deeper DoF
than a 200mm lens at f4 which has a shallower depth
Loading…

AUTOFOCUS

Accuracy

You can use the ow Gizmos Debug on the Component to view travel lines of the rays.
The rays are weighted with the centre ray being the highest priority, if your max distance doesnt hit anything the other rays will be used instead
This will enable smooth transitions between the centre ray to floor or something like a tree composed on the sides of the screen.
image.jpeg
From above you can see how the ray gizmo would look at runtime.
FOV Multiplier is how much of the camera’s Frustum the rays will fill
This is also directly related to your camera’s focal length and will adjust accordingly.
Accuracy is how many rays will fill the designated area.
Keeping accuracy at 1 represents 9 Focus Points. This is our recommendation for the cheapest performance cost when using Accurate [Focus Point Mode]

🆕 1.3.0 Simple [Focus Mode]

Typically, in modern games that have auto focus, there’s a single reference point to calculate the distance rather than multi point focus, which is our default.
You can find modes like this in games like Call of Duty: Vanguard and the UE5 Matrix Experience.
2022-03-18_09-51-55.gif

🆕 1.3.0 Tag Focus

Enabling Focus Tags allows you to give auto focus only to specific objects, you would otherwise have a fixed focus depth.
2022-03-21_10-15-09.gif

OVERRIDE VOLUMES

Override Volume

Will allow you to blend specific override values in scenes similar to using Unity’s Volume Framework
You’ll use this if you need to refine constraints or expand the auto DoF nature for a specific part of the scene.
You may not always be able to rely on auto focus and you may not want to fully disable it,
the volume overrides give you extended choices.
image.jpeg
Override Volumes are also linked with Presets
Override Volumes are able to be stacked upon too, we’ve dubbed this ‘Volumeception’ but it’s common practice to have many volumes controlling scene standards
The workflow is the same as normal Unity Volumes so there’s no steep learning curve
Override Volumes can be added to a normal unity volume:

Inspector of volume > add component > HIBIKI entertainment > PBADOF > Override Volume
Please ensure that your collision trigger has a character controller attached.
plus the camera tag matches the tag on the volume matches that of the tag name on the override volume.
image.jpeg
image.jpeg
image.jpeg
You can also add the component directly to pre existing unity volumes

🆕 1.3.0 Advanced Volume exp

An Advanced Volume is a volume that triggers when nothing is found within your Max Distance setting.
you can then override volume settings similar to our normal Override Volume.
Some great use cases of this is only allowing depth of field to function when you’re close to objects, you can consider this an ‘observer mode’.
or, if you want to increase of decrease the feeling of open and closed spaces, maybe to emphasize the feeling of claustrophobia, you can use this to increase or decrease the Focal length of the camera respectively.
An Advanced Volume will follow your camera.

🆕 1.3.0 ADS Volume exp


GLASS CHECK

image.jpeg
Glass check is a setting that allows users to look through a collider and set the focus correction, this could be useful for things like windows and doors, or display cases but also isn’t limited to just glass.
To enable glass check a collider you wish to look through must set it to have the Glass tag.
From there

@Glass [Check Range]
(in units) A field around the collider that is the activator.
@Glass [Focus Correction]
bias adjustment (in units) to tune your in focus object.
@Glass [Raycast Limit]
(colliders look through + focus object = amount you need)
@Glass [Focus Correction]
can also be used within the volume system to override base correction levels.

PRESETS

Presets can be made and used for both the main Component and the Override Volume Component.
This is designed within Unity’s Volume Framework, which means you will have extended flexibility from volume to volume which will allow you to further fine tune the Auto Depth of Field nature.
Blending different presets in and out of volumes
Leverage Integration of Cinemachine’s power, and mix with its focus rack and our Auto Depth of field in and out from gameplay to timeline and back.
Create a database of your favorite camera rigs and lens aperture set ups.
Remove ’full auto’ and design your shots and gameplay around your content.

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.