Hello!
I'm trying to add per vertex fog into the model shader. But the final color
overcomes to white.
end of the VS_GENERAL:
Code:
float _dist = length(vsPos);
if ( _dist >= gl_Fog.start )
{
fogFactor = clamp( ((_dist-gl_Fog.start)/gl_Fog.end) , 0.0 , 1.0);
}
else
{
fogFactor = 0.0;
}
end of the FS_LIGHTING:
Code:
gl_FragColor.rgb += ( gl_Fog.color.rgb - gl_FragColor.rgb ) * fogFactor;
end of the FS_AMBIENT:
Code:
gl_FragColor.rgb += ( gl_Fog.color.rgb - gl_FragColor.rgb ) * fogFactor;
Note: Exactly same shader approach worked for me in irrlicht.
Maybe the light, and the ambient pass added together? If yes, where?
Expected result:
Actual result:
(The fog color ofcourse not white
)