Correct the fog blend calculation for transparency.

The incoming pixel's alpha should not be affected by fog. This fixes the
ugly square smoke particles in foggy maps.
This commit is contained in:
Bill Currie 2012-07-17 19:08:36 +09:00
parent 0e7e45b91d
commit c4309e7abc
9 changed files with 9 additions and 9 deletions

View file

@ -28,7 +28,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
vec3

View file

@ -20,7 +20,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -22,7 +22,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -18,7 +18,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -17,7 +17,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -16,7 +16,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -21,7 +21,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -20,7 +20,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
void

View file

@ -26,7 +26,7 @@ fogBlend (vec4 color)
vec4 fog_color = vec4 (fog.rgb, 1.0);
f = exp (-sqr (fog.a / gl_FragCoord.w));
return mix (fog_color, color, f);
return vec4 (mix (fog_color.rgb, color.rgb, f), color.a);
}
vec2