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 ?
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 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