More actions
(Created page with "{{Infobox GB Homebrews |title=Sub-Pixel Scrolling Demo |image=subpixelscrollinggb.png |description=Sub-pixel accuracy scrolling on the Game Boy Color.. |author=Luc Van den Borre |lastupdated=1999/01/23 |type=Demos |version=1999 |format=CGB |license=Mixed |download=https://dlhb.gamebrew.org/gbhomebrews/subpixelscrollinggb.7z |website=http://vandenborre.org/ |source= |donation= }} {{#seo: |title=GameBrew |title_mode=append |image=subpixelscrollinggb.png |image_alt=Sub-Pixe...") |
No edit summary |
||
Line 7: | Line 7: | ||
|type=Demos | |type=Demos | ||
|version=1999 | |version=1999 | ||
|license=Mixed | |||
|format=CGB | |format=CGB | ||
|download=https://dlhb.gamebrew.org/gbhomebrews/spascrol.zip | |||
|download=https://dlhb.gamebrew.org/gbhomebrews/ | |||
|website=http://vandenborre.org/ | |website=http://vandenborre.org/ | ||
}} | }} | ||
{{#seo: | {{#seo: |
Latest revision as of 11:22, 30 July 2024
Sub-Pixel Scrolling Demo | |
---|---|
General | |
Author | Luc Van den Borre |
Type | Demos |
Version | 1999 |
License | Mixed |
System | CGB |
Last Updated | 1999/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:
Normally, if you were to scroll this row by one pixel to the left, you would get this:
But scrolling at sub-pixel accuracy, you take these steps:
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:
The second pixel is fully bright, the third has its green element fully turned on. What happens when you scroll this?
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
- Author's website - http://vandenborre.org/ (archived)