Merge pull request #54285 from briansemrau/fix-proximity-fade
Fix BaseMaterial3D proximity fade for Vulkan
This commit is contained in:
commit
16edca8415
|
@ -1100,7 +1100,7 @@ void BaseMaterial3D::_update_shader() {
|
||||||
|
|
||||||
if (proximity_fade_enabled) {
|
if (proximity_fade_enabled) {
|
||||||
code += " float depth_tex = textureLod(DEPTH_TEXTURE,SCREEN_UV,0.0).r;\n";
|
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 += " 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";
|
code += " ALPHA*=clamp(1.0-smoothstep(world_pos.z+proximity_fade_distance,world_pos.z,VERTEX.z),0.0,1.0);\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue