Increase shadow filtering

This commit is contained in:
Vincent Lejeune 2014-10-29 18:57:39 +01:00
parent ab82e3f62a
commit ee687440c7
2 changed files with 7 additions and 3 deletions

View File

@ -43,11 +43,12 @@ float getShadowFactor(vec3 pos, float bias, int index)
//float shadowmapz = 2. * texture(shadowtex, vec3(shadowtexcoord, shadowcoord.z).x - 1.;
// bias += smoothstep(0.001, 0.1, moved) * 0.014; // According to the warping
float sum = 0.;
for (int i = 0; i < 4; i++)
for (float i = -1.5; i <= 1.5; i+= 1.)
{
sum += texture(shadowtex, vec4(shadowtexcoord + shadowoffset[i] / 2048., float(index), 0.5 * shadowcoord.z + 0.5));
for (float j = -1.5; j <= 1.5; j+= 1.)
sum += texture(shadowtex, vec4(shadowtexcoord +vec2(i, j) / 1024., float(index), 0.5 * shadowcoord.z + 0.5));
}
return sum / 4.;
return sum / 16.;
}
void main() {

View File

@ -978,6 +978,8 @@ void IrrDriver::renderShadows()
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.5, 0.);
m_rtts->getShadowFBO().Bind();
@ -1022,6 +1024,7 @@ void IrrDriver::renderShadows()
}
glDisable(GL_POLYGON_OFFSET_FILL);
glCullFace(GL_BACK);
}