Hi,

in the manual, it is written that vecFogColor is a float3 and just stores the fog color, but if imported as float4 into a shader, vecFogColor.w stores a 0 or 1 if fog is activated or not. This is very useful. If multiplied with the fog density, it automatically switches fog treatment on and off, like this:

Code:
// fog density, always 0 if fog is disabled
float fFog = vecFogColor.w * smoothstep(vecFog.x, vecFog.y, distance);

// cover pixel with fog
color.rgb = lerp(color.rgb, vecFogColor.rgb, fFog);



It would be nice if you could add that info.

Last edited by HeelX; 04/07/13 10:59.