Sunday, June 26, 2011

Warp speed

To implement the warp speed effect I decided to implement a generic motion blur effect. My strategy for that is based on avoiding a tick-based integrator:

The engine used to have two callbacks; step and draw. For every tenth millisecond, the step function would be called to update the internal state of the starfield, moving all the stars towards the camera. Then the draw function would be called to update the image on the screen.

This is now rewritten to get rid of the step function. The draw function now has a time-parameter, and the state of the starfield is calculated from this.

This makes it possible to look anywhere on the timeline, and I use this to draw the stars from fifty consecutive milliseconds in every frame. This is CPU intensive enough to warrant a play/pause-button.

Source


No comments:

Post a Comment