Article View: rec.games.programmer
Article #1757Jerky animation (Was: The Correct Way to Control Game Speed)
From: Todd Lehman
Date: Sat, 19 Dec 1992 22:14
Date: Sat, 19 Dec 1992 22:14
60 lines
3048 bytes
3048 bytes
In article <1992Dec19.190258.15117@midway.uchicago.edu> greg@dent.uchicago.edu (Greg Kuperberg) writes:
>Now for some specifics. The eye and the visual cortex integrates
>separate images into continuous motion if the images appear at a rate
>faster than 5 or 10 times per second or so. 15 or more frames per
>second looks good, and it is a waste of CPU time to have more than 30
>redraws per second.
For 3D animation, sure...maybe the animation rate doesn't matter that much.
But for sprite-type animation, the animation rate actually DOES matter.
If you move an object at 30 f.p.s. on a monitor refreshing at 60 Hz., there
will be a double-image effect, and the animation will appear jerky. For
example, suppose you are moving a box horizontally at 30 f.p.s. If your
eyes follow the box as it moves, you will see this,
+----+----+----+
| | | |
| | | |
| | | |
| | | |
| | | |
+----+----+----+
rather than this,
+---------+
| |
| |
| |
| |
| |
+---------+
which is what you expected to see, and what you will see if you step up the
animation rate to match the refresh rate of the monitor at 60 Hz.
No matter how perfectly your page flipping / double buffering works, no
matter how fast your sprites are painted into video memory, if you move an
object n pixels every 2 video cycles, there will be a ghost image trailing
behind by n/2 pixels. (Don't believe it? Try it!)
For smooth sprite animation, it is helpful to match the animation rate of
the physical display, which in the case of VGA displays (to pick one out of
the air) can vary from 60 to 70 to 88 or more Hz., depending on the video
mode and the brand of monitor attached.
Of course, nobody moves sprites exactly one pixel per frame. Some jerkiness
is inevitable. But you can minimize it by starting out with a frame rate
equal to that of the physical display.
Has anyone else observed this ghosting effect? Does anyone know what is
the cause? I believe it to be an optical illusion, since the ghosting is
not there when your eyes remain fixed. It's the same kind of effect you
see when 24 f.p.s. movies are converted to 30 f.p.s. video cassette format
by doubling up every 5th frame. (Ever wonder why movies on TV look kind-of
jerky, but live video such as talk shows and soaps look smooth?)
--
Todd Lehman
toddl@county.lmt.mn.org
Technical Details
Message-ID:
<1992Dec19.221442.3741@news2.cis.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!umn.edu!newsReferences:
<1992Dec19.190258.15117@midway.uchicago.edu>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!umn.edu!news From: toddl@county.lmt.mn.org (Todd Lehman) Subject: Jerky animation (Was: The Correct Way to Control Game Speed) Message-ID: <1992Dec19.221442.3741@news2.cis.umn.edu> Sender: toddl@county.lmt.mn.org (Todd Lehman) Nntp-Posting-Host: poincare.geom.umn.edu Organization: A little References: <1992Dec19.190258.15117@midway.uchicago.edu> Date: Sat, 19 Dec 1992 22:14:42 GMT Lines: 61