Original Post
The attached image shows non-blurred VSM shadows adapted from here. The shadows seem to be working in a general sense (as in, they're there and they're actually correct) - however, there are some some strange artifacts that I can't seem to be able to get rid of: namely the banding-like effect in the non-shadowed part of the scene. Since I've reverted back to the shaders that are available when you click the link, I won't post the shader code, but here's my adaption of the application-side code (yes, it's a bit of a mess, but I'm still working on it ):
PS - ignore the light's frustum drawn as a cone - it's still rendered regularly as a capped pyramid.

Can anyone see anything wrong with this or has seen this kind of an effect before? If so, I'd appreciate some suggestions as to what I'm doing wrong!
Bonus question about fighting shadow acne - I was quite successful in getting rid of it when implementing regular cascaded shadows by using appropriate culling, polygon offset and blending any potential acne in the lighting term itself. However, VSM seems to be a bit more elusive - offseting has no effect and culling, while effective, still leaves visible seams near polygon edges. Increasing texture precision seems to have no effect and increasing resolution lessens the acne, but doesn't get rid of it (or even make it minimal). Is there anything else I can try or should I just try and avoid acute angles?
PS - for some reason GD tells me "This upload failed" when I try to attach my screenshot. Blah.
PS - ignore the light's frustum drawn as a cone - it's still rendered regularly as a capped pyramid.
//draw into an FBO with the light's depth texture (colorTextureID) as the target
EASSERT(smfbo->Bind());
//run the store depth shader
EASSERT(smsdshader->Enable());
drv->Clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
drv->LoadIdentity();
//set up the light's POV (this render target is shown in the small window)
drv->LookAt(
light->vPosition,
light->vOrientation,
TVector3D(1, 0, 0));
//the ground is not a closed shape, so disable culling for now
drv->EnableCulling(false, false);
RenderScene(drv, NULL);
//copied from the example
setTextureMatrix();
EASSERT(smsdshader->Disable());
EASSERT(smfbo->Release());
//generate mipmaps
drv->BindTexture(0, colorTextureId);
glGenerateMipmapEXT(GL_TEXTURE_2D);
drv->BindTexture(0, 0);
//draw the geometry from the camera's POV and apply the VSM texture
EASSERT(shadervsm->Enable());
//use the same TU (7) as the example
drv->BindTexture(7, colorTextureId);
//disable back face rendering
drv->EnableCulling(false, true);
drv->Clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
drv->camera->Look();
RenderScene(drv, NULL);
EASSERT(shadervsm->Disable());

Can anyone see anything wrong with this or has seen this kind of an effect before? If so, I'd appreciate some suggestions as to what I'm doing wrong!
Bonus question about fighting shadow acne - I was quite successful in getting rid of it when implementing regular cascaded shadows by using appropriate culling, polygon offset and blending any potential acne in the lighting term itself. However, VSM seems to be a bit more elusive - offseting has no effect and culling, while effective, still leaves visible seams near polygon edges. Increasing texture precision seems to have no effect and increasing resolution lessens the acne, but doesn't get rid of it (or even make it minimal). Is there anything else I can try or should I just try and avoid acute angles?
PS - for some reason GD tells me "This upload failed" when I try to attach my screenshot. Blah.

