pleopard
06-02-2004, 11:14 AM
I could use a little guidance on how to approach this effect ...
This is what I am doing ...
I have a missile traveling over my terrain and it is tracking a target on the ground. Its search pattern is a simple frustum defined by an azimuth FOV and an elevation FOV. So, in each frame, after rendering the missile and its target, I draw a transparent frustum from missile to just a little past the target. I can see the missile's search cone superimposed on the target and its boundaries all the way back up to the missile.
This is what I want to do ...
I want to be able to project the search pattern onto my terrain and not have to draw the frustum. That is, all of the terrain area within the search frustum's projected boundaries will be discolored or outlined somehow.
I could trace four rays from the missile to the four corners of the search pattern on the ground and then do a terrain height query at regular intervals between these points to get the projected outline but that would be extremely expensive computationally (like 0.1 seconds per frame or more for my situations).
Can't I achieve this effect somehow with the stencil buffer (GL_STENCIL_TEST)? Has anyone attempted a similar problem as this? If so, can you give me any advice/guidance or point me to a good resource that would educate me on such a technique?
This is what I am doing ...
I have a missile traveling over my terrain and it is tracking a target on the ground. Its search pattern is a simple frustum defined by an azimuth FOV and an elevation FOV. So, in each frame, after rendering the missile and its target, I draw a transparent frustum from missile to just a little past the target. I can see the missile's search cone superimposed on the target and its boundaries all the way back up to the missile.
This is what I want to do ...
I want to be able to project the search pattern onto my terrain and not have to draw the frustum. That is, all of the terrain area within the search frustum's projected boundaries will be discolored or outlined somehow.
I could trace four rays from the missile to the four corners of the search pattern on the ground and then do a terrain height query at regular intervals between these points to get the projected outline but that would be extremely expensive computationally (like 0.1 seconds per frame or more for my situations).
Can't I achieve this effect somehow with the stencil buffer (GL_STENCIL_TEST)? Has anyone attempted a similar problem as this? If so, can you give me any advice/guidance or point me to a good resource that would educate me on such a technique?