Shadow Detection

Hi,everyone.I am doing research on rendering shadow in 3D graphic using OpenGL,and I know about the algorithm of shadow mapping which can create shadow in 3D graphic.Now my task is to detect the area of shadow in 3d graphic,could you tell me how I can do the job?

I don’t think you can easily do that with shadow mapping.
Perhaps a differnt shadowing approach (like Doom 3) which uses shadow extrusion may help. I think for that you need to supply vec4 for each of your model’s verticies though.

Thanks for your reply.Perhaps I think geometry shader may help,but the verticies of 3D model are processed in geometry shader implicitly.How OpenGL can know the result of each vertex explicitly,then we can determine which face on the surface of 3D model is in the shadows or not?

Not sure if I understand your need.
You want to find shadows from a real world photograph ? Or you know the geometry of shadow caster, and want a boolean shadow/noshadow value for each part pixel on screen ?

Sorry! Maybe I did not make it clear.
First,I am not dealing with a 2D photograph,but a 3D model (e.g a 3D face model)currently.So,this is not a 2D shadow detection problem.
Second,I need to detect the shadow area on the surface of the 3D model under a scene with general ambient light and diffuse light.(Assume that these is no obstruction before the model)
My problem is to how to determine which vertex(not pixel but real vertex that has xyz coordinate) of the 3D model is in the shadows or not.
It is easy to get the 2D shadow texture by OpenGL,but I do not think it is a method to solve my problem.

Ah much clearer thanks.
A OpenGL solution could be :

  • render depth map from light (classic shadow mapping)
  • do the depth compare in vertex shader (classic shadow mapping way is to do it in fragment shader), and store result in a vertex attribute
  • use vertex transform feedback to retrieve the value for each vertex

It seems a good solution!Anyway,thank you for your advice!