|
@@ -694,7 +694,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
|
|
@@ -860,6 +862,7 @@ void main() {
|
|
|
/////////////////////// FOG //////////////////////
|
|
|
#ifndef MODE_RENDER_DEPTH
|
|
|
|
|
|
+#ifndef FOG_DISABLED
|
|
|
#ifndef CUSTOM_FOG_USED
|
|
|
// fog must be processed as early as possible and then packed.
|
|
|
// to maximize VGPR usage
|
|
@@ -874,6 +877,7 @@ void main() {
|
|
|
uint fog_rg = packHalf2x16(fog.rg);
|
|
|
uint fog_ba = packHalf2x16(fog.ba);
|
|
|
|
|
|
+#endif //!FOG_DISABLED
|
|
|
#endif //!MODE_RENDER_DEPTH
|
|
|
|
|
|
/////////////////////// DECALS ////////////////////////////////
|
|
@@ -1744,8 +1748,10 @@ void main() {
|
|
|
diffuse_light *= 1.0 - metallic;
|
|
|
ambient_light *= 1.0 - metallic;
|
|
|
|
|
|
+#ifndef FOG_DISABLED
|
|
|
//restore fog
|
|
|
fog = vec4(unpackHalf2x16(fog_rg), unpackHalf2x16(fog_ba));
|
|
|
+#endif // !FOG_DISABLED
|
|
|
|
|
|
#ifdef MODE_MULTIPLE_RENDER_TARGETS
|
|
|
|
|
@@ -1762,8 +1768,10 @@ void main() {
|
|
|
specular_buffer = vec4(specular_light, metallic);
|
|
|
#endif // MODE_UNSHADED
|
|
|
|
|
|
+#ifndef FOG_DISABLED
|
|
|
diffuse_buffer.rgb = mix(diffuse_buffer.rgb, fog.rgb, fog.a);
|
|
|
specular_buffer.rgb = mix(specular_buffer.rgb, vec3(0.0), fog.a);
|
|
|
+#endif // !FOG_DISABLED
|
|
|
|
|
|
#else //MODE_MULTIPLE_RENDER_TARGETS
|
|
|
|
|
@@ -1773,8 +1781,10 @@ void main() {
|
|
|
frag_color = vec4(emission + ambient_light + diffuse_light + specular_light, alpha);
|
|
|
#endif // MODE_UNSHADED
|
|
|
|
|
|
+#ifndef FOG_DISABLED
|
|
|
// Draw "fixed" fog before volumetric fog to ensure volumetric fog can appear in front of the sky.
|
|
|
frag_color.rgb = mix(frag_color.rgb, fog.rgb, fog.a);
|
|
|
+#endif // !FOG_DISABLED
|
|
|
|
|
|
// On mobile we use a UNORM buffer with 10bpp which results in a range from 0.0 - 1.0 resulting in HDR breaking
|
|
|
// We divide by sc_luminance_multiplier to support a range from 0.0 - 2.0 both increasing precision on bright and darker images
|