Skip to content

Commit 5d39031

Browse files
committed
game_dir: glsl: fixed incorrect fog blending on some of brush entities
1 parent 6ca60d3 commit 5d39031

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

game_dir/glsl/forward/decal_bmodel_fp.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ void main( void )
160160

161161
#if defined( APPLY_FOG_EXP )
162162
#if defined( APPLY_COLORBLEND )
163-
result.rgb = CalculateFog(result.rgb, u_FogParams, length(u_ViewOrigin - var_Position));
163+
result.rgb = CalculateFog(result.rgb, u_FogParams, gl_FragCoord.z / gl_FragCoord.w);
164164
#else
165-
float fogFactor = saturate(exp2(-u_FogParams.w * length(u_ViewOrigin - var_Position)));
165+
float fogFactor = saturate(exp2(-u_FogParams.w * gl_FragCoord.z / gl_FragCoord.w));
166166
result.a *= fogFactor; // modulate alpha
167167
#endif
168168
#endif

game_dir/glsl/forward/decal_studio_fp.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void main( void )
133133
#endif // LIGHTING_FULLBRIGHT
134134

135135
#if defined( APPLY_FOG_EXP )
136-
result.rgb = CalculateFog(result.rgb, u_FogParams, length(u_ViewOrigin - var_Position));
136+
result.rgb = CalculateFog(result.rgb, u_FogParams, gl_FragCoord.z / gl_FragCoord.w);
137137
#endif
138138
gl_FragColor = result;
139139
}

game_dir/glsl/forward/scene_bmodel_fp.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void main( void )
283283
#endif // USING_SCREENCOPY
284284

285285
#if defined( APPLY_FOG_EXP )
286-
result.rgb = CalculateFog(result.rgb, u_FogParams, length(u_ViewOrigin - var_Position));
286+
result.rgb = CalculateFog(result.rgb, u_FogParams, gl_FragCoord.z / gl_FragCoord.w);
287287
#endif
288288

289289
#if defined( LIGHTMAP_DEBUG ) || defined( LIGHTVEC_DEBUG )

game_dir/glsl/forward/scene_grass_fp.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void main( void )
4444
#endif//LIGHTING_FULLBRIGHT
4545

4646
#if defined( APPLY_FOG_EXP )
47-
diffuse.rgb = CalculateFog(diffuse.rgb, u_FogParams, length(u_ViewOrigin - var_Position));
47+
diffuse.rgb = CalculateFog(diffuse.rgb, u_FogParams, gl_FragCoord.z / gl_FragCoord.w);
4848
#endif
4949
gl_FragColor = diffuse;
5050
}

game_dir/glsl/forward/scene_studio_fp.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ lighting.diffuse += var_AmbientLight;
220220
#endif
221221

222222
#if defined( APPLY_FOG_EXP )
223-
result.rgb = CalculateFog(result.rgb, u_FogParams, length(u_ViewOrigin - var_Position));
223+
result.rgb = CalculateFog(result.rgb, u_FogParams, gl_FragCoord.z / gl_FragCoord.w);
224224
#endif
225225
// compute final color
226226
gl_FragColor = result;

0 commit comments

Comments
 (0)