100 likes | 109 Views
Learn about animation in computer graphics, including frame rates, video formats, and timing. Explore various animation options and techniques.
E N D
CPT 450 Computer Graphics 12th Lecture – Animation
Animation • A series of images (of the same size), shown in rapid succession, to give the illusion of motion to the human brain. • Animation is not new to computer graphics and was done using hand drawn frames (as in cartoons) or using still photographs (see Edison’s National Historical Site in West Orange, NJ.)
Monitors • In the USA, standard TV broadcasts 30 frames per sec • Computer monitor have refresh rates > 60 Hz to avoid interference with lighting. (users complain of flicker, headaches, etc.) • Interlaced scan – screen refreshed at twice the frame rate. • First pass, the odd number rows of pixels are updated. • Second pass, the even rows of pixels are updated. • This scheme makes the motion appear smoother. • Progressive scan – all the rows of pixels are updated sequentially, in one pass. Used by computer monitors.
Frame Rates • Frame rate (Hz) = 1 / (time interval in seconds) (frames/sec or Hz) = 1000 / (time interval in mSecs) • Too slow - the motion will appear jerky, like an old silent movie. (< 12 frames per second or Hz) • Too fast - faster than the monitor can update - can cause image tearing. (> ~85 Hz, see your graphics card and monitor specs.) • Just right - To give the appearance of smooth motion, you should try to use a frame rate of at least 30 Hz. * Depends on speed of object moving within the frames. Larger changes between frames require faster frame rates.
Temporal Aliasing • If the frame rate is too slow, you may see wheels turning in the wrong direction – a strobe effect. • The is called temporal aliasing. • It is analogous to spatial aliasing, except in the time domain, instead of in the spatial domain. • Aliasing occurs when the rate is below the Nyquist frequency.
Video Formats • A wide variety of format exist for displaying video. • QuickTime, Flash, AVI, animated GIF, MPEG, MOV, … • AVI is short for "Audio Video Interleave", the file format for Microsoft's Video for Windows standard • MOV (Quick Time Movie File Extension) is a video and animation system developed by Apple Computer • MPEG1, MPEG2 - Motion Picture Experts Group • Frame rate - These formats are expected to played back at a certain frame rate. • Streaming versus non-streaming • Compressed versus non-compressed • Common players - Windows Media Player, Apple Quick Time, Real Player
Timing • Timing is very important! 2 methods • Clock watching • sit in a loop and watch the system clock until we reach the desired time. Do doEvents Loop While (currentTime() < endTime) • Use Timer control. • Important properties: • Interval property (msec) • Enabled property (boolean) • Your code inside timer event is executed every “interval” milliseconds. • Timing is not exact, but close enough for us.
Animation Options • Clear and Redraw - Clear everything and then redraw everything. • Store animation frames for replay or compute them in real time. (This can be computationally intensive). • Save background image and only redraw changes in foreground. • Double buffering
Animation • Simulation - applying the laws of Physics. Used by academia, industry and the military. And in project 3! (See Stephens’ planets demo) • Scripts – contain lists of positions and angles of objects at each discrete time. Sensors can be placed on human body to record these positions. This technique is used by the movie industry. • Sprites: a programming abstraction that represents some object in animation. Sprite classes contain methods to moveSprite and drawSprite • Tweening & Morphing – in between frames are interpolated
Project 3 • Use clear and redraw approach, inside of a timer event. • Choose appropriate frame rate, based on your computer’s speed. • Class mySprite contains methods for drawing and moving the sprite.