Shadow map size-based artifact

Started by
14 comments, last by belfegor 11 years ago

Hi everyone,

I've noticed that when I raise the size of my shadow map above 512x512, the following artifact creeps in at the bottom:

[attachment=14836:artifact1.jpg]

I'm not sure why - it only appears when I raise the shadow map size! Is it a simple issue?

Thanks.

Advertisement

Can you show the same screen shot with a smaller resolution shadow map? Also, what is the artifact that you are describing - the shape of the shadow itself?

Hi, sorry if it wasn't visible.

The only thing casting a shadow should be the pyramid, but in the first pic there's a long rectangle added onto the shadow for some reason. Here's how it looks with a 512 shadow map:

[attachment=14838:arti2.jpg]

There's no rectangle at the bottom. Also, in the first picture, the artefact is shadowing the object itself too, so for some reason it seems to think there's an object blocking the light there.

Is your object hitting the edge of the shadow map? That's why we need to see what the actual shadow map looks like.

I thought it might have been, but this is what I get when I render the shadow map straight to the screen - they both look the same:

512:

[attachment=14839:512sm.jpg]

1024:

[attachment=14840:1024sm.jpg]

Is there a way to save the shadow texture itself to a file? I guess that would be a better diagnostic!

D3DXSaveSurfaceToFile

Ah, well I dumped my render surface to a png file and it came out with this at a size of 1024x1024. I guess that's the problem. I should also say that the cutoff starts at 768 pixels down - the size of my back buffer. So does that mean I can only use maps smaller than my back buffer?

[attachment=14841:test.png]

No, the backbuffer size shouldn't matter. Maybe check to make sure your viewport is correct when you're rendering your shadow map?

Its been a while, but don't you need to set a z/depth-buffer thats at least the size of your current render target? Experienced some issues like this a while ago, I swear it was something with depth buffer, but I can't really tell anymore.

As said above, did you created separate depth/stencil buffer beside your RT on which you render shadow depth? And set it before render to shadow RT?

Did you set new viewport based on shadow map size/camera properties?

This topic is closed to new replies.

Advertisement