PDA

View Full Version : Perspective `zoom' - where did it go?



Robbo
04-20-2002, 12:00 PM
Some time ago someone posted a tutorial for executing a zoom operation on a scene (calculating fov etc. from a rectangular area drawn out on the screen) - I can't find the tut anywhere now.

Can someone point me in the correct direction please?

ScottManDeath
04-21-2002, 11:29 PM
Hi

this can be done using the stencil buffer as following

1. Render to stencil, not to frame buffer the shape of you zoom, a sphere or a quad
setup the stencil buffer so that it write a 1 where it rendered

2. Render your scene with normal fov but enable stenciltest so that it fails where the stencil is 1

3. Render your scene with zoomed fov but enable stenciltest so that it succeds where the stencil is 1

Bye
ScottManDeath



[This message has been edited by ScottManDeath (edited 04-22-2002).]

zeckensack
04-22-2002, 02:03 AM
Rectangles are also perfect candidates for the scissor test, so you don't need to mess with the stencil buffer.

1)Disable scissor test
2)set normal projection
3)Draw non-zoomed stuff
4)set scissor rectangle
5)enable scissor test
6)clear depth
7)set up 'zoom' projection
8)render zoomed stuff