Skip to content

Vulkan: Separate near/far dof_blur_amount no longer available (unlike 3.x) #62473

@TokisanGames

Description

@TokisanGames

Godot version

4.0.alpha10

System information

Win 10/64 NVIDIA GeForce GTX 1060/PCIe/SSE2

Issue description

Godot 4 has one setting for dof_blur_amount.
Godot 3 has two, one for near and one for far.
Since Godot isn't calculating real DOF, the near and far planes may need to be different values, so both should be provided.

Example 1:

I've written a physical camera for Out of the Ashes that calculates the real depth of field ranges based upon aperture and focal length of my lens. Then I position the DOF blur plane distances according to the math, set the transition value to the same as the distance, and simulate the amount of blur based upon math, a lot of experimentation, and my photographic experience.

Here you can see that the near plane has a strength of 0.12 and the far plane 0.062. Near distance 3.561, Far distance 4.619.

This is not possible in Godot 4, but should be.

image

Example 2:
At https://dofsimulator.net/en/ you can play with camera lenses and position of objects and see how the focus ranges are positioned. This demonstrates why having only one blur setting is physically incorrect.

Here is a 90mm lens at f/4, with the subject 20m away. You can see the background is nearly in focus in the sample image. This is because, as you see on the bottom, the far focus plane is very close to the infinity focus mark, where anything after that distance is in focus. You can see the hyperfocal distance is 34.91m, meaning if the subject is there or farther, the background will be perfectly in focus. However, that does NOT mean everything in front of the subject is also in focus! Imagine if someone's head or hand steps in front of the camera within 5m. Is it also going to be as nearly in focus as the background? No, it's going to be a very blurry mess.

image

Steps to reproduce

Built into the engine.

Minimal reproduction project

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions