Advertisement

LOD Transition Shadow Artifacts

Started by July 28, 2023 04:45 AM
3 comments, last by SBD 1 year, 3 months ago

In the process of testing my LOD transition scheme, I've noticed some shadow artifacts during the transition in certain circumstances. I'm doing the “dither cross fade” via clip/discard method for the transition, and for my test I'm using a sphere with two LODs that are quite different (further LOD is half the polygons of the closest LOD). Predictably, when transitioning between the two, this causes shadowing to appear in the center of lower LOD polygons until the transition is complete. During the shadow generation pass (cascaded shadow maps) I am submitting both LODs. Obviously, there is no way to generate proper shadows in this somewhat contrived example, but I'm wondering if anyone has experienced this issue and had any clever solutions? I've thought about monkeying with some depth bias during the shadowing calculations, but that seems like it would be full of weird corner cases. Trying to do some smart submission of only the target/destination LOD during the shadow pass seems like it would just move the problem to the other LOD.

My guess is this isn't really much of an issue for sensibly generated LODs on “real world” geometry, but I'd be interested to hear your guys' experience.

Have you tried culling front faces when drawing the shadow maps? (drawing only back faces)

Advertisement

@Aressera To this point I've avoided the back face shadow map generation simply because it introduces an additional requirement of geometry being “backside watertight”. Mind you, that's a completely reasonable requirement for shadow-generating geometry, and I don't think I'm currently really doing anything that relies on front-face-only shadow geometry. To your point, that would certainly address this particular issue. I'll give this a shot and see what I can see…should just be a simple matter of adjusting the shadow pass culling and then tweaking the shadow comparison in the shaders.

I managed to get the back face shadow map generation working relatively easily…indeed, it does address the LOD transition shadowing issue. Of course, the shadowing itself is not working perfectly as I have various depth biases to (re)adjust/invert (I have different depth biases per shadow cascade that I manually apply in the shader), and as expected it exposes issues with double-sided geometry that I'll probably have to solve by smartly adjusting the depth biases in those cases, if possible. In thinking about it more, it seems to me that backside shadow map generation should potentially eliminate the need for depth biases in general, yes?

However, with that solved, a further issue is exposed; (HB)SSAO artifacts. Lower LOD generates occlusion from the higher LOD geometry that is stippling in/out, thus producing erroneous occlusion shadowing. Not sure there's a good answer here…I suppose I could turn off HBSSAO on the lower LOD during transition (I have a forward renderer, so this isn't terribly difficult), but that will still mean a popping on when the lower LOD is fully on.

Again, it may be that in “real world” scenarios this isn't a real noticeable issue…I am just staring at a huge sphere doing a severe LOD transition at a very close distance.

This topic is closed to new replies.

Advertisement