# Vanishing point off the screen? [ASCII art now:]

## Recommended Posts

rein    122
hello there gamedev community! it's my 1st post here, but I've been following the threads for a long time anyway. however, I come up with a problem: How do I set the vanishing point (lets say it's a top-down view) beyond the screen boundaries? #Tip: Imagine we have a huge projection, say, twice width and height of the screen, and we want to scroll the view only to see the different parts of the rendered scene. Normally the v point would be in the center of the viewport - right? but if we scroll to top-left corner, it would move slightly to the right-bottom of the screen - do you follow me? If we just transform the matrix, every single node will be recounted due to the point in the middle of the screen, so we'll come up with all the same center-projection. Maybe there's some way to render a bigger part of the projection, and than just move it around without again and again processing? Is there any friendly method of doing so? or I must play with huge viewports and scaling? :/ rein [Edited by - rein on August 5, 2004 7:15:00 AM]

##### Share on other sites
vincoof    514
I'm not quite sure the effect you want to get here. Do you want to see a larger scene with the same window size ? If so, just setup the correct parameters to glOrtho/gluOrtho2D or glFrustum/gluPerspective (whichever you call in your program). Typically with glOrtho, gluOrtho2D and glFrustum you just have to enlarge the x and y ranges, and for gluPerspective you just have to increase the fovy (vertical field-of-view) parameter.

 Oh I was just about to forget : A Warm Welcome to the community ! [grin]

##### Share on other sites
rein    122
 +-------+          +----+ |       |\        /|    | |    +--+|       / |    |               *  - Vanishing point |    |\__\      /  +----+ +----+|         | /    /                #  - our screen  \____\         |/    /                 +----+                       so all I want to do ################                              is to scroll the #            * #                              screen around the#              # ______                       static view#    ______    #|\     \                                         #   /     /|   #| \_____\                     as You can see in #  +-----+ |   #| |     |                     this example the v#  |     | |   #| \---+ |                     point is not in the################|  \___\|                     center of the moni-   +-----+       \ |   |+                     tor                  \|___|                                              if we just scroll,                                              the projection wont                                              change, only the                                               visible part of the                                              already renderer                                              scene

sorry for this crappy ascii art, but my ftp is down and I got no time for uploading any data to free image hosting sites :)
but I hope it makes it a bit clearier

as for the re-setting gluPerspective (it's a 3d view - just like in GTA 1, or 2) - will it forbid physical drawing out of the screen bounds and limit it only for the visible monitor space - or I'll waste cpu/3dcard for unnecessary rendering outside the screen?

anyways, I find your solution something in-topic. If I'll set the rendernig space to for example 1280x960 (accroding to screen resolution of 640x480) the v point seems to be somwhere in 640x and 480y - do I understand correctly? but now - how can I determine which part of projection I want to see (0,0,640,480 or maybe 640,0,1280,480 or else) ?

and thanks for such a warm welcome :)
rein

##### Share on other sites
Ubik    1339
The following should work:

-Set the the matrixmode to projection.
-GlScale() x and y by the amount you need - if you need 1/4-view then you scale by 2.0, if you need 1/9-view then you scale by 3.0 and so on.
-Then just glTranslate() by the offset value. Before translating the projection still has the vanishing point in the middle of the screen, so if you want say the lower left quarter, then you translate by +half screen widht, +half screen height to move the vanishing point to upper right corner of the screen.

I have not tested it myself, so i'm not sure about it though.

There is of course some rule to build the projection matrix directly, but i let finding it to you. :)

##### Share on other sites
rein    122
hmm, maybe I did sth worng, but wherever I put glTranslate it gives all the same effect - changes the matrix, not the projection. So I'm not moving the vanishing point (which holds still in the center) but the matrix against it :/ [well, thats what the description of this func says anyway]

so far, I managed to move the twice big viewport around - and it works fine now (but isnt that a tricky way?) having a viewport (-640,-480,1280,960) huh?

so, I count the perspective for the real vanishing point (which is my position point) and then move the viewport due to my VIEW position.

ok, but thanks for help guys!
c.u.
rein

##### Share on other sites
vincoof    514
Great ASCII art [wink]
At least it wastes much less web space, thus uses less download bandwith, and becauses it is embedded in the page you can edit it easily and keep it on the site without broken links that images usually do.</off topic>

I'm sorry but this wonderful picture doesn't help me understanding your goal ! I mean, what is the point about the "vanishing point" ? What does that mean ? TIA

##### Share on other sites
Guest Anonymous Poster
well, in most simple case, the vanishing point is the point, where all perspective lines come together - it's placed right on the observer's horizon line.

if you know the basis of how the 3d graphics work (generally perspective), you must have heard of it. there can be up to 3 so called "v" points, but in most cases 2 are enough to render man's perception.

#################################
# / #
#---------+ / #
# |\ +---+ #
# | \ /| | # * vanishing point
# | \ / | | #
# | | | | | #
#- - - - -|- |--*--| |- -|- - - #

in such projection you can spot the point, where all "depth-lines" use to vanish (those diagonal lines).

so, my problem with opengl was, the v point stack in the center of the screen (where its supposed to be normally) and I could make it move around the screen.

note that, if you transform the view - strafe for example, the world matrix will change and all the diagonals will move slightly to end up in the screen center (v point)

if you rotate - it's all the same - everything joins in that one hot spot...

...............
now, try to think of a method to constrain opengl to make these lines connect somwhere else than in the middle of the monitor - that was my goal, and finally I reached it :)

##### Share on other sites
rein    122
##################################                          /    ##---------+               /     ##         |\         +---+      ##         | \       /|   |      #     *   vanishing point#         |  \     / |   |      #          #         |  |     | |   |      ##- - - - -|- |--*--| |- -|- - - #   <--   horzion line   #         |  |     | |   |      ##         |  /     \ |   |      ##         | /       \|   |      ##---------+/    _    +---+      ##              |||        \     ## 100+ 50A    /|||\        \    #   <--   quake HUD :+)#################################

I'm sorry, that post above was mine, and here's the correct image :)

##### Share on other sites
vincoof    514
Ok I didn't know the English term ^^'

You can simply setup the projection differently by filling asymmetric parameters to glFrustum. Note that you need to leave gluPerspective, as this function always centers that vanishing point to the center of the screen.