diff options
author | Milan Gruner <milangruner@gmail.com> | 2023-09-04 00:04:14 +0200 |
---|---|---|
committer | Milan Gruner <milangruner@gmail.com> | 2023-09-05 18:15:02 +0200 |
commit | 45a33cc749683882d4fafb8c813b39f7ce5a896f (patch) | |
tree | 82733ad98402ee49bf446a36a995fdaa4b7874cb /drivers/gles3/shaders | |
parent | 75de1ca76871fdf7f5a9e081aa57ec0e33061107 (diff) | |
download | redot-engine-45a33cc749683882d4fafb8c813b39f7ce5a896f.tar.gz |
Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 7cba77be2f..8d3eabc55b 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -962,7 +962,9 @@ void main() { float clearcoat_roughness = 0.0; float anisotropy = 0.0; vec2 anisotropy_flow = vec2(1.0, 0.0); +#ifndef FOG_DISABLED vec4 fog = vec4(0.0); +#endif // !FOG_DISABLED #if defined(CUSTOM_RADIANCE_USED) vec4 custom_radiance = vec4(0.0); #endif @@ -1075,6 +1077,7 @@ void main() { #ifndef MODE_RENDER_DEPTH +#ifndef FOG_DISABLED #ifndef CUSTOM_FOG_USED #ifndef DISABLE_FOG // fog must be processed as early as possible and then packed. @@ -1088,6 +1091,7 @@ void main() { uint fog_rg = packHalf2x16(fog.rg); uint fog_ba = packHalf2x16(fog.ba); +#endif // !FOG_DISABLED // Convert colors to linear albedo = srgb_to_linear(albedo); @@ -1300,6 +1304,8 @@ void main() { frag_color.rgb += emission + ambient_light; #endif #endif //MODE_UNSHADED + +#ifndef FOG_DISABLED fog = vec4(unpackHalf2x16(fog_rg), unpackHalf2x16(fog_ba)); #ifndef DISABLE_FOG @@ -1310,7 +1316,8 @@ void main() { frag_color.rgb *= (1.0 - fog.a); #endif // BASE_PASS } -#endif +#endif // !DISABLE_FOG +#endif // !FOG_DISABLED // Tonemap before writing as we are writing to an sRGB framebuffer frag_color.rgb *= exposure; |