View Full Version : Shadow Detection
02-15-2012, 04:42 AM
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?
02-15-2012, 05:36 AM
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.
03-08-2012, 11:22 PM
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?
03-09-2012, 12:40 AM
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 ?
03-09-2012, 01:50 AM
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.
03-09-2012, 05:28 AM
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 (http://www.opengl.org/wiki/Transform_Feedback) to retrieve the value for each vertex
03-09-2012, 06:23 PM
It seems a good solution!Anyway,thank you for your advice!
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.