Use fog start value to determine density
This commit is contained in:
parent
84affec451
commit
bd4fe57524
@ -1,10 +1,6 @@
|
||||
uniform sampler2D tex;
|
||||
|
||||
uniform float fogmax;
|
||||
uniform float startH;
|
||||
uniform float endH;
|
||||
uniform float start;
|
||||
uniform float end;
|
||||
uniform float density;
|
||||
uniform vec3 col;
|
||||
|
||||
out vec4 FragColor;
|
||||
@ -19,7 +15,7 @@ void main()
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
float dist = length(xpos.xyz);
|
||||
vec3 fog = col * (1. - exp(- fogmax * .01 * dist));
|
||||
vec3 fog = col * (1. - exp(- density * dist));
|
||||
|
||||
FragColor = vec4(fog, 1.);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ void PostProcessing::renderFog()
|
||||
|
||||
|
||||
FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::FogShader>(fogmax, startH, endH, start, end, col);
|
||||
DrawFullScreenEffect<FullScreenShader::FogShader>(1. / (20. * start), col);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -1842,7 +1842,7 @@ namespace FullScreenShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/fog.frag").c_str());
|
||||
|
||||
AssignUniforms("fogmax", "startH", "endH", "start", "end", "col");
|
||||
AssignUniforms("density", "col");
|
||||
AssignSamplerNames(Program, 0, "tex");
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ public:
|
||||
SSAOShader();
|
||||
};
|
||||
|
||||
class FogShader : public ShaderHelperSingleton<FogShader, float, float, float, float, float, core::vector3df>, public TextureRead<Nearest_Filtered>
|
||||
class FogShader : public ShaderHelperSingleton<FogShader, float, core::vector3df>, public TextureRead<Nearest_Filtered>
|
||||
{
|
||||
public:
|
||||
FogShader();
|
||||
|
Loading…
Reference in New Issue
Block a user