• Advertisement

Archived

This topic is now archived and is closed to further replies.

Another 3D question...perspective?

This topic is 6550 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made a wall that is 600 wide and 600 high in world coordinates and it appears a certain size on the screen in x and y (say 400x400 pixels). However, when I rotate the wall around 90 degrees so that I stand parallel to it, it goes off into the distance (right to the horizon) eg. the 600 units distance appears to be a lot greater in z (on the screen that is) than in x and y - this is causing a stretching effect when I rotate. Would somebody know what is causing this, know how to fix it? All I do for perspective is divide x and y by z, I have no field of view implemented yet (coz I don't know how!). Any help appreciated, Paulcoz. Edited by - paulcoz on 2/11/00 1:47:38 AM

Share this post


Link to post
Share on other sites
Advertisement
The fact that the wall seems to stretch in the z direction has everything to do with field-of-view. Lower the field of view and it should not stretch as much.

FOV sets the opening angle of the frustrum, e.g. if you have FOV at 90 degrees and you stand at the corner of a room with orthogonal walls then you''ll both walls.

To compute FOV ask yourself this question: How much can be seen at one units distance? If a two unit wall at one unit distance fills up the entire screen then you have 90 degree FOV. If a four unit wall at one unit distance fills up the entire screen then what FOV do you have? (Tip: Use arctan)

Share this post


Link to post
Share on other sites
there is a tutuorial under the reference/programming/3d and theory that is pretty good. it is part 2 of five, i think (by chris hargrove)

hope that helps

Share this post


Link to post
Share on other sites
Finally, my troubles are over...Eureka!!

Thanks guys,

I didn't have anything in my program to take into account the field of view (multiplying x and y by distance from screen or dividing z by distance from screen, so after much studying of the projection formulas and projection matrices on the weekend I found the 'missing link'.

As soon as I fixed the field of view all my other problems (stretching effect during rotations etc..) went away, and now my program works pretty well - I can walk all the way around this little cube I built

Good stuff,
Paulcoz.

Edited by - paulcoz on 2/13/00 7:55:49 PM

Share this post


Link to post
Share on other sites

  • Advertisement