diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-27 18:25:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 18:25:06 +0200 |
commit | 16edca841599b216909ac2ed569cfa9bdc631176 (patch) | |
tree | 4fb74fbb41a20bd0924656aefa0280934e3e09c9 | |
parent | 18a2c38ad2282ffc2bec9c17055c51d1a1dc0e5f (diff) | |
parent | 791773fa9d8a9e353608bb778a1e0247940d91f9 (diff) |
Merge pull request #54285 from briansemrau/fix-proximity-fade
Fix BaseMaterial3D proximity fade for Vulkan
-rw-r--r-- | scene/resources/material.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index abb3381c4e..267180973f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1100,7 +1100,7 @@ void BaseMaterial3D::_update_shader() { if (proximity_fade_enabled) { code += " float depth_tex = textureLod(DEPTH_TEXTURE,SCREEN_UV,0.0).r;\n"; - code += " vec4 world_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV*2.0-1.0,depth_tex*2.0-1.0,1.0);\n"; + code += " vec4 world_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV*2.0-1.0,depth_tex,1.0);\n"; code += " world_pos.xyz/=world_pos.w;\n"; code += " ALPHA*=clamp(1.0-smoothstep(world_pos.z+proximity_fade_distance,world_pos.z,VERTEX.z),0.0,1.0);\n"; } |