I’m encountering this problem when rendering shadow maps that the first shadow map to be rendered only has a corner cleared on Renderer.clearBuffers
. Here’s a visualization of the problem (white=close, black=far)
When the light moves, the scene “smears” onto the edges of the texture, which I’m guessing means those parts are never cleared.
int w = ...;
int h = ...;
for (int i = 0; i < numShadowMaps; i++) {
Camera shadowCam = ...
FrameBuffer fb = ...
Texture2D shadowMap = ...
FrameBuffer.RenderBuffer current = fb.getDepthTarget();
if (current == null || current.getTexture() != shadowMap) {
fb.setDepthTarget(FrameBuffer.target(shadowMap));
fb.setUpdateNeeded();
}
renderer.setFrameBuffer(fb);
renderer.clearBuffers(true, true, true);
rm.setCamera(shadowCam, false);
context.renderGeometry(occluderQueue, shadowCam, null);
}
It’s only the first shadow map, too. All the other maps are fine, and they’re set up the same way as the first. I’ve tried switching things around as well, but it’s always the first shadow map rendered. Any ideas on what’s going on here?