Skip to content

Allow using separate amounts for near and far depth of field#62501

Open
Calinou wants to merge 1 commit intogodotengine:masterfrom
Calinou:dof-blur-separate-near-far-amount
Open

Allow using separate amounts for near and far depth of field#62501
Calinou wants to merge 1 commit intogodotengine:masterfrom
Calinou:dof-blur-separate-near-far-amount

Conversation

@Calinou
Copy link
Copy Markdown
Member

@Calinou Calinou commented Jun 28, 2022

This restores functionality that was available in Godot 3.x's depth of field.

Tested on the Vulkan Clustered and Vulkan Mobile backends, with all combinations of bokeh shapes and bokeh qualities. It works 🙂

The only quirk I noticed is that near blur's amount will appear to change if you also change the far blur amount (and vice versa). I'm not sure how this can be fixed.

Testing project: test_dof_blur_separate_near_far_amount.zip

This closes #62473.

@Calinou Calinou requested review from a team as code owners June 28, 2022 22:27
@Calinou Calinou added this to the 4.0 milestone Jun 28, 2022
@TokisanGames
Copy link
Copy Markdown
Contributor

TokisanGames commented Jun 28, 2022

Thank you.

The only quirk I noticed is that near blur's amount will appear to change if you also change the far blur amount (and vice versa). I'm not sure how this can be fixed.

What does that mean?

My physical camera adjusts near and far planes and blur amounts every frame according to the focal point, aperture/fov, and DOF distance calculations. It also racks focus, so iterates these changes over time as the focal point moves from A to B.

So as long as the blur amount is stable it should be fine because I calculate and adjust both each frame. By stable I mean, if near blur of 0.1 @ 10m when far blur is X is not the same as near blur of 0.1 @ 10m when far blur is Y, that's a problem. Or if the blur shape or pattern changes frame to frame, that's also an issue. Then we have dancing noise like the moving shadows when rotating a directional light, or flickering SS ambient occlusion in Godot 3.

This restores functionality that was available in Godot 3.x's
depth of field.
@Calinou Calinou force-pushed the dof-blur-separate-near-far-amount branch from 41f3b0a to e093cfd Compare June 30, 2022 20:40
@TokisanGames
Copy link
Copy Markdown
Contributor

I'm currently porting my PhysicalCamera to test this, but GDScript 2 has many changes and gotchas that I'm working through. I've already noticed a problem with depth changes between blur quality. I'll update when I have something definite.

@TokisanGames
Copy link
Copy Markdown
Contributor

The overall blur look is soooo much better in Godot 4 than 3. My camera is ported, however I came across the bug documented in #62678. I cannot continue testing this one until the other one is fixed.

@MJacred
Copy link
Copy Markdown
Contributor

MJacred commented Oct 26, 2024

@TokisanGames: #62678 got fixed. Can you resume your testing of this fix?

@TokisanGames
Copy link
Copy Markdown
Contributor

@MJacred read from here #62473 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants