Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Need help on shadow mapping

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5

    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.

  2. #2
    Junior Member Newbie yoyonel's Avatar
    Join Date
    Sep 2010
    Location
    Paris
    Posts
    23
    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

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    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.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    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.

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    Click image for larger version. 

Name:	opengl_issue.jpg 
Views:	95 
Size:	9.1 KB 
ID:	974Click image for larger version. 

Name:	opengl_good.jpg 
Views:	95 
Size:	8.7 KB 
ID:	975

    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?

  6. #6
    Junior Member Newbie yoyonel's Avatar
    Join Date
    Sep 2010
    Location
    Paris
    Posts
    23
    Oki i see, i think it's the "acnee problem" with shadow mapping.
    Look here => http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    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

  7. #7
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    5
    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.

  8. #8
    Junior Member Newbie yoyonel's Avatar
    Join Date
    Sep 2010
    Location
    Paris
    Posts
    23
    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).
    Last edited by yoyonel; 02-04-2013 at 06:08 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •