Computer Graphics

Raster Methods for Computer Animation

  • We can create simple animation sequences in our programs using real-time methods.
  • We can produce an animation sequence on a raster-scan system one frame at a time, so that each completed frame could be saved in a file for later viewing.
  • The animation can then be viewed by cycling through the completed frame sequence, or the frames could be transferred to film.
  • If we want to generate an animation in real time, however, we need to produce the motion frames quickly enough so that a continuous motion sequence is displayed.
  •  Because the screen display is generated from successively modified pixel values in the refresh buffer, we can take advantage of some of the characteristics of the raster screenrefresh process to produce motion sequences quickly.

[wp_ad_camp_1]
Double Buffering

  •  One method for producing a real-time animation with a raster system is to employ two refresh buffers.
  • We create a frame for the animation in one of the buffers.
  • Then, while the screen is being refreshed from that buffer, we construct the next frame in the other buffer.
  • When that frame is complete, we switch the roles of the two buffers so that the refresh routines use the second buffer during the process of creating the next frame in the first buffer.
  • When a call is made to switch two refresh buffers, the interchange could be performed at various times.
  • The most straight forward implementation is to switch the two buffers at the end of the current refresh cycle, during the vertical retrace of the electron beam.
  • If a program can complete the construction of a frame within the time of a refresh cycle, say 1/60 of a second, each motion sequence is displayed in synchronization with the screen refresh rate.
  • If the time to construct a frame is longer than the refresh time, the current frame is displayed for two or more refresh cycles while the next animation frame is being generated.
  • Similarly, if the frame construction time is 1/25 of a second, the animation frame rate is reduced to 20 frames per second because each frame is displayed three times.
  • Irregular animation frame rates can occur with double buffering when the frame construction time is very nearly equal to an integer multiple of the screen refresh time the animation frame rate can change abruptly and erratically.
  • One way to compensate for this effect is to add a small time delay to the program.
  • Another possibility is to alter the motion or scene description to shorten the frame construction time.

[wp_ad_camp_1]
Generating Animations Using Raster Operations

  • We can also generate real-time raster animations for limited applications using block transfers of a rectangular array of pixel values.
  • A simple method for translating an object from one location to another in the xy plane is to transfer the group of pixel values that define the shape of the object to the new location
  • Sequences of raster operations can be executed to produce realtime animation for either two-dimensional or three-dimensional objects, so long as we restrict the animation to motions in the projection plane.
  • Then no viewing or visible-surface algorithms need be invoked.
  • We can also animate objects along two-dimensional motion paths using color table transformations.
  •  Here we predefine the object at successive positions along the motion path and set the successive blocks of pixel values to color-table entries.
  • The pixels at the first position of the object are set to a foreground color, and the pixels at the other object positions are set to the background color .
  • Then the animation is then accomplished by changing the color-table values so that the object color at successive positions along the animation path becomes the foreground color as the preceding position is set to the background color

Leave a comment

Your email address will not be published. Required fields are marked *