Jump to content
  • Advertisement
Sign in to follow this  
bhavinvs

I'm getting confused with palette.

This topic is 4498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm refering one book in tht all the game graphics thing are explained with Example.It uses 8bit bitmap images and one palette for displaying most of the images in game. "The artist must, of course, be aware that all art work used in the body of the game will use the same palette",wht this means.I'm getting confused.

Share this post


Link to post
Share on other sites
Advertisement
you're reading an old book. ;) older games like for example warcraft 2 and starcraft had a palette of colors that had to be used for all pixels on the screen. so each pixel is 8 bit index into the palette. nowadays we have nice video cards that do 24 bit color and 32 bit textures and in fact most don't even support palettes anymore.

Share this post


Link to post
Share on other sites
While blackpawn is quite correct, and you should really get a more up to date book, I'll just expand a bit on the idea of palettes in case you are stuck with the book or a very old computer or something.

A colour is described by three bytes - its red, green and blue components, each of which vary between 0 and 255. When you are NOT using palettes, the video memory needs to store this information for each pixel. So a 640x480 image on the screen would take 921600 bytes in 24bit colour mode.

In the days when computer video memory was limited, the computer would instead store a list of colours, known as the palette, seperately from the actual images. In 8 bit mode, this list would store 256 different colours.

Each pixel in the image would then index into this list, rather than contain the colour information directly, meaning (in 256 colour mode) it only takes one byte instead of three to store the pixel, reducing the example above down to 307200 bytes, plus 768 bytes to store the palette.

However, since there can only be one palette at a time, it is necessary that all of the different images used in the program take their colours from the same palette.

While using palettes sucks for this reason, there are some interesting effects that you can achieve more simply than with true colour or high colour displays. For example, a fade to black effect can be achieved by just fading the values in the palette rather than having to modify every pixel on the screen.

It is a very old-fashioned approach though and you would very rarely find palette-based graphics code in any application these days.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!