Graphics Rendering - PathogenDavid/Periodic GitHub Wiki
Graphics rendering in the period project is done using the FB32 graphics mode. (Details about the specific graphics modes available on the Sifteo platform can be found in the Sifteo SDK documentation.) This mode is limited in that it uses 32 by 32 pixels and a 16 color palette. While this may seem limited (especially considering that the Sifteo screens are 128 pixels squared), it was necessary to allow both reliable, flicker-free animation and color.
At the beginning of the project, many different graphics modes were evaluated for their usefulness in this project. You can find the code base used to evaluate the graphics modes at the end of version 0.1, sprint 1. The tests mostly focus on the ability to use animation.
Here are the different tests that were performed, along with their upsides and downsides:
- Windowed Sprites (
EDT_WINDOWED_SPRITES
)- Animates several sprites back and forth across the screen. This uses the
BG0_SPR_BG1
graphics mode. It was intended to explore the possibility of exceeding the typical 8 sprite limit by rapidly refreshing only half of the screen. - PROS: With two tile-based background layers and up to 16 sprites, this mode offers a lot of visual precision, color, and animation.
- CONS: The sprites flicker, especially at the bottom half of the cube. It also suffers some complex issues with how animated sprites can appear on the screen.
- Animates several sprites back and forth across the screen. This uses the
- FB Mode 32 (
EDT_FB_COLOR
)- Animates several differently colored pixels back and forth across the screen.
- PROS: Has color, is very fast to update, no flicker, stuff can appear anywhere.
- CONS: Pretty low resolution, limited number of colors. What seems to be a bug in the Sifteo cubes causes some artifacts on occasion. Framerate is smoother than windowed sprites, but animation is chunky due to low resolution. The Sifteo asset pipeline doesn't offer any support for this mode.
- FB Mode 64 (
EDT_FB_BW
)- Animates several white pixels back and forth across a black screen.
- PROS: Same as FB Mode 32, but higher resolution and without color.
- CONS: Only two colors (effectively a background and a foreground), which made this mode unacceptable for us.
- Screen flicker (
EDT_FULL_CLEAR
)- This mode was intended simply as a stress test of the Sifteo graphics system.
- Circle (
EDT_CIRCLE
)- This mode is to test fast full-screen animation of the FB64 mode in a way that was easier to demonstrate to our client.
We would've liked to use the windowed sprites method, but the flicker was simply too annoying, and having to be careful with where animated bits went was a little frustrating. In the end, we felt that using FB32 mode was the best of all our options, so it is what the project uses.
Because the Sifteo asset pipeline doesn't really do much of anything for us when we use the raw framebuffer modes, we have to do a lot ourselves. For example, we had to write our own font generation tool and font rendering.
Currently our palette has 8 shades of gray and 8 colors. They are listed below: