Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Sub-Pixel Scrolling Demo GB

From GameBrew
Sub-Pixel Scrolling Demo
Subpixelscrollinggb.png
General
AuthorLuc Van den Borre
TypeDemos
Version1999
LicenseMixed
SystemCGB
Last Updated1999/01/23
Links
Download
Website

An assembler demo that smoothly scrolls half of the screen one pixel at a time, and the other half 1/3 of a pixel at a time.

User guide

Each pixel on the CGB screen is made up out of three thin color elements of red, green and blue. You can see this for yourself if you put a drop of water on the screen, as a makeshift magnifying glass. The elements in each pixel are ordered red, green, blue from left to right, but of course any other order would do as well. Look at this diagram of a row of pixels on the CGB screen:

subpixelscrollinggb2.png

Normally, if you were to scroll this row by one pixel to the left, you would get this: 

subpixelscrollinggb3.png

But scrolling at sub-pixel accuracy, you take these steps: 

subpixelscrollinggb4.png

Voila, three times as smooth. Of course, this comes at a price. Scrolling on the GB is done in hardware, while all this business is going to take a considerable amount of (video) memory and processing whichever way you implement it. Also, if you're scrolling something made up out of multiple colors, the constant reordering of pixel elements might result in very apparent color clash changes. Consider this example: 

subpixelscrollinggb5.png

The second pixel is fully bright, the third has its green element fully turned on. What happens when you scroll this? 

subpixelscrollinggb6.png

As you can see, the single green element 'jumps' to different positions compared to the fully bright 'pixel', which could result in some visual artefacts. 

Also, the Game Boy has a palletized display, so there's a limited amount of colors to work with. Just scrolling our single fully bright pixel at sub-pixel accuracy created four new colors: rgB, RGb, rGB and Rgb. (that is, (0,0,255),(255,255,0), etc.) 

Not all is lost, though, as there are other, more appropriate uses for the same idea. Due to the way the eye perceives color, sub-pixel rendering can be very useful for static images - not in the least for text, which is monochrome most of the time anyway. See also Sub-Pixel Font Rendering Technology for an excellent overview of the issues involved.

External links

Advertising: