Skip to content
Physically Based Auto Depth of Field
Share
Explore
Physically Based Auto Depth of Field

Features

2-Click auto setup
Create-your-own Camera and Volume Presets
Full Tooltips and Comments throughout
Simple to extend further into your own tools and systems
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
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
AUTOFOCUS
Accuracy
You can use the Show 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 0-1 = 0-100%
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 default recommendation for the cheapest performance cost.
🆕 1.3.0 Centre Ray Only
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
VOLUME OVERRIDES
Volume overrides
Will allow you to blend specific override values in scenes 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
Volume Overrides are also linked with
Volume Overrides 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
Volume overrides can be added to a normal unity volume:

inspector of volume> add component>HIBIKI entertainment> Depth Of Field> PBDOF Volume Override
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 Advance 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 volume override.
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 advance 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 A bias adjustment (in units) to tune your in focus object.
Glass Raycast Limit (colliders look through + focus object = amount you need)
Glass Check’s 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 Auto DoF component and the Volume Override component.
This is designed within Unity’s Volume Framework system, 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 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.

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.