determining if in shadow

Is it possible to determine if an object is completely in a shadow?

I am using projective shadow mapping, only one light for now. I’m trying to think of a way to tell if an object is completely in the shadow or not.

The only way I can think of is render the scene minus the object from the light’s POV and save it. Then render the scene with the object from the light’s POV, and compare it with the first depthmap. This seems terribly slow and clumsy.

I’m thinking about per-pixel techniques, but per-triangle would work also… Does this even make a difference? It seems to be a hard problem, but maybe I’m overlooking something.

Thanks

You could use the occlusion query extension (currently an NV extension (HP for a limited ver of it) but soon to be moved to an ARB extension, i believe) and check how much of it is drawn when drawing your depth map. Simply render everything bar the object first, then start an occlusion query and render the object, and read back how much of it was rendered.

Looks to be exactly what I’m looking for.

Thanks!