Change fog equation
This commit is contained in:
parent
85bbc0f8b8
commit
84affec451
@ -15,13 +15,11 @@ vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(tex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
float z = texture(tex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
float dist = length(xpos.xyz);
|
||||
float fog = smoothstep(start, end, dist);
|
||||
float dist = length(xpos.xyz);
|
||||
vec3 fog = col * (1. - exp(- fogmax * .01 * dist));
|
||||
|
||||
fog = min(fog, fogmax);
|
||||
|
||||
FragColor = vec4(col, fog);
|
||||
FragColor = vec4(fog, 1.);
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ void PostProcessing::renderFog()
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
|
||||
FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
|
||||
|
@ -538,6 +538,7 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
core::matrix4 transform = translate * scale;
|
||||
core::matrix4 invtransform;
|
||||
transform.getInverse(invtransform);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glUseProgram(MeshShader::SkyboxShader::getInstance()->Program);
|
||||
MeshShader::SkyboxShader::getInstance()->setUniforms(transform);
|
||||
|
Loading…
Reference in New Issue
Block a user