4df2af2cef
Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
16 lines
No EOL
415 B
GLSL
16 lines
No EOL
415 B
GLSL
//#define fog_FuncTION
|
|
//varying vec3 PointPos;
|
|
|
|
vec3 fog_Func(vec3 color, int type)
|
|
{
|
|
//if (type == 0){
|
|
const float LOG2 = 1.442695;
|
|
//float fogCoord =length(PointPos);
|
|
float fogCoord = gl_FragCoord.z / gl_FragCoord.w;
|
|
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
|
|
|
if(gl_Fog.density == 1.0)
|
|
fogFactor=1.0;
|
|
|
|
return mix(gl_Fog.color.rgb, color, fogFactor);
|
|
} |