Line of Sight - Light Shadow from Spotlight..

Here is my problem. I have a terrain and i have a spotlight in that terrain…

The spotlight usually points down so it forms a cone. What i need is a way to render only the areas that are visible from the spotlights perspective, Like some kind of line of sight test.

Now i tried with shadow mapping but didn’t quite get anywhere.

I was thinking would it be possible to draw from the view of the spotlight ( btw. how do i set my projection to be as the spotlights ) into a FBO and then just dont lit anyface that is not in the FBO. In essence like the shadow mapping just not drawing a shadow map.

Or would it be possible to use occlusion query to chek what is not being “seen” by the light and not litting it ?

Any ideas would be very helpfull… Thanx

The general idea of what you are trying to do is clear, but the specifics of what you want are not.

Are there any portions of surfaces facing the light source and within the light source’s falloff distance that you “do not” want to illuminate?

If not, then you just want to light the surfaces within the light’s falloff distance without any consideration of shadowing.

If so, then you need some kind of point-light shadow computation as well (such as cube map shadow maps).

Your first sentence makes me wonder though whether you’re just asking about how to cull your scene to the falloff distance of the light source…

Here is a screencap of what i am trying to do…

the areas that are circled in red are the areas the i dont whant to have light on. since it is being shadowed by the hill tops :slight_smile: The cube shows the position of the spot light.

I guess you are just trying to implement the shadow mapping for a spot light. It’s not an easy task, as there is no interpolation-correct projection for the camera with FOV>180c.

Try do dig up the following topics:
*dual-paraboloid shadow maps
*shadow cube-maps
*stencil-based shadows