godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.92k stars 20.16k forks source link

Material transparency bug over far blured environnement #40948

Open jmb462 opened 4 years ago

jmb462 commented 4 years ago

Godot version: Observed since 3.2.2 (not tested earlier) -> 3.2.3RC3

OS/device including version: Tested in Linux / MacOs and Windows environnements

Issue description: When far blur is activated in environnement, Transparent material meshes don't deal correctly (i think) with depth.

Either the mesh is sharp but the background inside the mesh isn't blurred anymore This is the case when depth draw mode is set to Always in the material setting

Either the mesh over the blur background is also blurred even if it's not enough far from the camera to be blurred by far blur. This is the case for all other depth draw mode (Opaque only, opaque prepass or never)

Steps to reproduce: Configure a far blur environnement. Add a semi transparent mesh

bug

Minimal reproduction project: TransparencyBug.zip

Calinou commented 4 years ago

Related to #28240.

Can you test this in Godot 3.1.2 and 3.1.1 as well, just in case?

jmb462 commented 4 years ago

Thanks, I've just tried 👍 with 3.1.1 and 3.12 : the mesh and the background inside is always blured even with Depth draw mode set to Always. (like the top cube in my previous screenshot)

clayjohn commented 4 years ago

Unfortunately there is no easy solution for this. The DOF blur is a post process effect that relies on depth. If you do an alpha prepass, the renderer no longer can tell the difference between the mesh and the background ( it only stores one depth value) so it can't tell that the background should be blurry through the mesh.

jmb462 commented 4 years ago

So sad , so far blur has to be avoid when using transparent meshes.

Here is a photoshoped screenshot to show the result I wish I could obtain. edited_goal

Calinou commented 2 years ago

Can anyone reproduce this in the master branch? I assume the issue still stands there, but it's good to check just in case.

Edit: Disregard the accidental close-open below, I misclicked.

akyoto commented 7 months ago

image

This has depth pre pass enabled but DoF still blurs the gpu particles on 4.2.1.

"Depth draw mode: Always" prevents the blur but creates a lot of artifacts within the particle effect itself.

Maybe we could add a depth postpass with an alpha clipping threshold?

solitaryurt commented 4 months ago

Am experiencing this with 4.2.2 stable.