Need help on shadow mapping

I have a code that does the 2 pass shadow map creation. It generates the depth buffer into a 2D texture and the does the rendering again to make the shadows. When my object and the light are oriented very close to each other I see these shadowed triangles on a side where they shouldn’t be. When the light is moved such that is not oriented in the same angle as the object the rendering and shadows are fine. Is there anyone out there that has experience in this area? I can get into more detail when I find someone who may be able to help.

Thanks.

Not sure to understand well your problem.

Please attached images/pictures of your program/problems.

Some possible ways to know what happens:

  • Draw your 2D Depth Buffer (using for Shadow-Map pass)
  • Verify your near/far plane for light camera, render your light-camera (wireframe frustum in your 3d scene)
  • post your shader (vertex/pixel/fragment) here, to be sure you do the right things ^^

Good luck,
YoYo

I don’t have the ability to post attachments I can e-mail them to you and we can either converse over e-mail or over this medium. I did draw out the depth buffer but I’m not sure what it should look like anyways to know if its right or wrong. The rendering works fine for most of the angles its just these cases where the angles coincide that are the problem. I’d like to send you the images if you can provide an e-mail somehow.

How do I post images. I can try to do it. My images are on my laptop not in a URL like the add image wants.

[ATTACH=CONFIG]373[/ATTACH][ATTACH=CONFIG]374[/ATTACH]

Images are attached, I think. You can see the correct one is properly shaded and the incorrect one has the triangles. The correct one has the object and the light position both at 225 degrees. The incorrect one has the object at 225 degrees and the light at 226 degrees. Any ideas?

Oki i see, i think it’s the “acnee problem” with shadow mapping.
Look here => Common Techniques to Improve Shadow Depth Maps - Win32 apps | Microsoft Learn
Very useful page, it’s for DirectX but you can use it for OpenGL with no problem.
Your problem look like the Figure 7: High-projective aliasing vs. low-projective aliasing
=> "
Projective aliasing occurs when the surface normal is orthogonal to the light; these surfaces should be receiving less light based on diffuse lighting equations."
I Hope that’s can help you !
Good Luck !
YoOoYoOoOOoOo

Thanks for the reply. It sounds like the issue is that when the comparision of the depth value to the shader value there may be precision issues and the depth value is less than the shader value so it looks shaded. I tried to increase the resolution of the depth 2d texture and it seems to help somewhat but I can only increase it so far then the texture allocation fails. I am using Mesa for the opengl implementation. Do you know what the memory limit its bumping up against. I have 6 GB ram and The texture is only around 38MB in size. I have an NVIDIA GPU I could port to as well, maybe that has more resources.

For the resolution, with hardware support, i think the limit is 4096² or 8192² (not more).
But you can subdivise your light viewport and have the size that you want (independtly of your hardware/mesa_implementation limitation).
You can also use a infinite simpling of your light, with changing orientation of thelight camera view, and/or slightly moving the position in a virtual micro-sphere (like 0.1 unit/opengl radius for the sphere or less).
With this rendering (1 rendering for each ‘virtual’ light camera), you can mix the results (average/mixing) and produce 1 rendering (antialiased).
With this kind of techniques, you can reach the ‘perfect rendering’ i.e. near/close to the shadow volume or raycasting solutions ! (but increase rendering time).