(Bug) Depth of Field is not taking physical values into account properly.

I'm currently comparing real world depth of field with the HDRP depth of field, setting the same physical properties in both to the same values. (50mm lens, aperture of f2.0, same sensor size).
My expectation would be that the amount of blur generated by the depth of field post processing effect is similar to the real lens, but it's much less.
Even opening the game cameras aperture as wide as f1.0 doesn't come close to the real world behaviour. There has to be something wrong in the calculations in the depth of field effect.

Is this something that's going to be fixed soon? As we are relying on physically correct values for all our cameras it's important to get the look right.


1 Like

This new blog post by Unity mentions that a physical camera should affect the Depth of Field correctly:

"HDRP also provides a Manual Focus mode for the DoF using non-physically-based Near and Far Blur distances. Nevertheless, I highly recommend using the Physical Camera mode instead and mimicking real-world automotive photography. In doubt, sticking to traditional cinematographic conventions and shot composition will avoid raising eyebrows. For instance, the use of an ultra-wide lens should be restricted to very specific scenarios, such as action shots, because they tend to introduce unwanted perspective distortions when shooting a subject at close range. And an unnecessarily shallow Depth of Field can negatively impact the sense of scale and look unrealistic, or video-gamey. Additionally, you can link the Camera’s Field of View to its Focal Length and prevent unrealistic DoF scenarios caused by using both a very wide field of view and a very high focal length simultaneously, knowing that those 2 parameters are inversely proportional." - Pierre Yves Donzallaz

Well it does affect the Depth of Field, but not correctly. It's even resolution dependent!
While the change in the cameras focal length results in a change of the DoF, the amount of DoF is more comparable to having a small sensor than in my case a Super 35 sized sensor.

1 Like

Did you tried all the advanced settings that having an impact on DoF?
From the docs:
Here is a list of the physical Camera properties that affect the Depth of Field effect when you select Use Physical Camera from the Focus Mode drop-down.

Property Effect
Aperture The larger this value, the larger the bokeh and overall blur effect.
Blades Count This determines the shape of the bokeh. For more information on the effect this property has, see the example below.
Curvature Determines how much of the blades are visible. Use this to change the roundness of bokeh in the blur. For more information on the effect this property has, see the example below.

Yes, every single setting is properly defined. While the Blade Count and Curvature influence the "look" of the bokeh, the actually relevant settings for DoF are the Focal Length, Aperture, and the Sensor Size of the Camera. A higher Focal Length or lower Aperture Value result in a shallower DoF as expected, but the actual amount of DoF (think of it as kind of "intensity") doesn't match with the real world tests. (It's actually quite different).
That ultimately means that it's currently almost impossible to achieve a realistic DoF, since I can't go lower than f/1.0 on the aperture side (which actually mostly makes sense, even if there are a few real world lenses that go to f/0.95), and changing the focal length would obviously result in a change of the FoV...

1 Like

This info is really interesting for us and it would be really helpful if you could share pictures so we can measure the difference.
One thing to keep in mind is that our blur is done in realtime and as such bigger radius is more expensive.
We have a few ways to limit the cost, one of which is limiting the radius. We try to be as resolution independent as possible but this radius limit is resolution dependent.
In Unity 19.3 HDRP 7.1.7 you need to set the quality to custom and show advanced properties using the cog icon in order to have access to all of the settings. This allows you to tweak max radius, setting it to the highest value allows you to go higher in bokeh size.
I hope this helps.

Hi Laurenth, thanks for the detailed answer. I understand the performance related tweaks, but I would expect something like a Clamp here, limiting the max bokeh size, but that's actually not the problem. In fact, I can achieve a shallower depth of field by using a longer lens. It almost seems like the whole range is remapped instead of clamping the max blur, which results in almost non perceptible DoF with shorter lenses.
I will do some tests next week and post some comparison pictures here.


I'm noticing the Physical camera is not really 'physical' in the sense compared to UE4 cameras.
For instance, and in addition to what @Onat-H has mentioned, I find something "off". Depth of field effectively works as a post processing feature.
ISO has no effect in a scene (even the standard HDRP example one of the construction site)

Can we have some more detailed answers/examples please or a tutorial showing off Unity's Physical camera in comparison to real world cameras in these aspects.

*edit: An Exposure 'override' component needs to be added to a volume, and only then will ISO etc, which is part of the main camera 'physical settings', work. Very un-intuitive workflow, imo.