Shadow mapping

Hi all,

Here’s my issue: I’m looking to detect shadow in a picture. It so happens that I have a three-dimensional object of the scene (obtained through stereo method) and I’m trying to assess if shadow mapping is a sensible method to find the shadow in the picture. For this I’m trying to use openGL as I think it’s probably the most optimized solution out there. My objective is to output a 2D binary image corresponding to the shadow map from the camera point of view. I have everything I need, I can render the scene in 3D without issues but I do not know where to get the shadow map from and to output it as a binary mask.

If you have any input, I would greatly appreciate it,

… I have a three-dimensional object of the scene …
This statement makes no sense to me. Did you mean to say you have a “3D image”? Do you have an OpenGL program that generates the images? Have you written this program yourself? Can you change the source code? If so, it should be easy to determine where the shadows lie. It would be very helpful (to me) if you could post an image. Do you know where the light source is located in the scene?

Hi Carmine, thanks for your reply! I have a 3D image. I place the light source and then render the scene from a given point of view (different from the light source). This naturally leads to shadows appearing in the scene and I want to extract these shadows as a 2D binary mask as seen from the point of view. Nothing really fancy here, and I am pretty sure it must be straightforward for a seasoned openGL programmer but I can’t find any info as to where and how I can extract this.

Don’t have an easy answer for you. I’ve implemented OpenGL shadowing using the shadow mapping approach. My code was based on examples I found on the web. The basic idea is easy to understand, but the OpenGL implementation was hard for me to follow on a line-by-line level. So I’m not the one to give advice on this topic. You could try what I did by looking at examples of shadowing code on the web until you find one that made enough sense to use as a template.

sounds to me like you are missing the basic idea of how to do it …
maybe just to get you started, a little easy help:

Thanks for your replies guys. uwi2k2, I understand the principle fairly well, I have implemented the algorithm in Matlab and can obtain the result I want there. I want to use openGL for efficiency (speed GPU + better precision). I am just trying to locate/extract (or how to create) the two-dimensional shadow-map of the scene as seen from the camera point of view. And I am having trouble finding where/how it is stored by openGL.

Shadow mapping is quite an advanced technique for a beginner and will require you to learn most aspects of ‘modern’ OpenGL (shaders, textures, FBOs). There’s lots of good tutorials on the internet, but I would recommend for its clarity, and it includes a page about shadow mapping as well.