vecFogColor.w

Posted By: HeelX

vecFogColor.w - 04/07/13 10:56

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.
Posted By: jcl

Re: vecFogColor.w - 04/08/13 13:43

Yes, this will be documented.
© 2024 lite-C Forums