🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1413

Re: 3D Rotation

#1413
From: Gene Ressler
Date: Mon, 08 Apr 1991 18:14
49 lines
3356 bytes
In article <41021@cup.portal.com> Bobster@cup.portal.com (Robert Jules Shaughnessy) writes:
>
>     I also have had this problem. I think you should fallow what is said
>in reply #2 and then be sure to NOT DRAW ALL LINES/POINTS witha NEGATIVE
>Z coordinate. This will cause objects to disapeare when they go behind the
>view screen (Coordinate Origin). I think this may be what you want since if
>you do not do this, you do get that local rotation effect. Also there are
>other ways of doing this. (If your using lines) You could draw the lines with
>only one negative z coordinate by substituting the -z for 0. This would let
>yyou view an object more clearly as you pass through them.

To beat a dead horse ;-), what is really wanted (at least in concept) is to
_clip_ to the perspective view volume in _3D_, then draw.  (There is
no `behind the observer' for orthogonal projections.) This volume is the
(infinite) double pyramid formed by projecting lines through
the observer point to the corners of the viewport (think `screen').
Without 3D clipping, objects in the `other' lobe of the pyramid
from the viewport are projected upsidedown --- not surprising as in
this case you've effectively modeled a pinhole camera.

Check out the 3D version of the Liang Barsky clipping algorithm.
It nicely truncates 3d lines to just the viewport lobe
of the pyramid.  Hence when you fly through objects, they
swell to the size of the screen, then are cleanly clipped as you get
too close for the whole thing to fit, then disappear after you've gone
through.  Or you can have a 3d database with both an airplane and the
ground and get a correct simulated image sitting in the seat
looking out the window.  If you just skip lines with a point of negative
Z coord, chunks of the airplane will be missing.   

If you need to clip _polygons_ instead of just lines (say
for hidden surface removal), then look at the Sutherland-
Hodgeman algorithm.

L/B is presented in Hearn and Baker, Computer
Graphics (though I can't recall if they do the 3d version --- you may
have to look up Liang's paper in the references; it's very clear and
easy to program from.  S/H is in Foley and Van Dam, Fundamentals
of interactive computer graphics (and many others).  They do a chapter
on `the graphics pipeline' that is _very_ worthwhile study if you're doing
3D imaging.  These guys virtually invented computer flight simulations; they
know what they're talking about.

Having said this, I gladly admit that programs like MS Flight simulator
play all kinds of games to get around the expensive (read floating point)
computation of the above algorithms.  But you can't understand the games
until you've got the rules.

Happy landings, Gene
Technical Details
Message-ID: <1991Apr8.181450.15309@cs.cornell.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!ressler
References: <1991Apr05.224711.12750@lynx.CS.ORST.EDU> <1991Apr5.201714.29494@kuhub.cc.ukans.edu> <41021@cup.portal.com>

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer,alt.msdos.programmer,comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!ressler
From: ressler@CS.Cornell.EDU (Gene Ressler)
Subject: Re: 3D Rotation
Message-ID: <1991Apr8.181450.15309@cs.cornell.edu>
Sender: news@cs.cornell.edu (USENET news user)
Nntp-Posting-Host: cello.cs.cornell.edu
Organization: Cornell Univ. CS Dept, Ithaca NY 14853
References: <1991Apr05.224711.12750@lynx.CS.ORST.EDU> <1991Apr5.201714.29494@kuhub.cc.ukans.edu> <41021@cup.portal.com>
Date: Mon, 8 Apr 1991 18:14:50 GMT
Lines: 49