rend3 icon indicating copy to clipboard operation
rend3 copied to clipboard

Strange lighting issues with directional light + overlapping geometry

Open marstaik opened this issue 1 year ago • 5 comments

Video demonstration

There seems to be a square "plane" following the cameras position, that when it hits overlapping geometry causes the lighting to turn black. When you zoom out far enough, the lighting goes to normal. Note that the geometry underneath has no lighting issues.

marstaik avatar Nov 24 '23 20:11 marstaik

You're seeing shadows! The directional light shadow map is only so big (it's configurable in the light descriptor) so what you're seeing is there being no shadows if you're too far away from the shadow map (centered at the camera) and shadows being introduced as you get closer.

cwfitzgerald avatar Nov 27 '23 06:11 cwfitzgerald

@cwfitzgerald that makes sense, but the shadows are still appearing in the wrong spots it seems. It looks like the shadow map is backwards for some reason on those overlapping portions, IE shadow is being applied on the geometry on top and not the geometry on bottom if you look at the video.

There is no geometry occluding from above for there to be shadows on the mesh on the top side.

marstaik avatar Nov 27 '23 16:11 marstaik

image

marstaik avatar Nov 27 '23 16:11 marstaik

As a note, I am using a right-handed coordinate system with z-up. In case that might be messing with the math somewhere.

marstaik avatar Nov 27 '23 16:11 marstaik

@marstaik do you have a reproduction case I can play with? It's hard to debug these things outside of renderdoc

cwfitzgerald avatar Dec 30 '23 01:12 cwfitzgerald