• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# pallet troubles....

## Recommended Posts

hello beginner here i was wondering if anybody knows of a web site that teachs u about pallet''s how to set them up change them around that type of stuff, cause i''m looking at writing a fire routine and well i haven''t seen any of them done in 16bit which is what i''v done most of my graphics stuff in thx for any help

##### Share on other sites
woops forgot to add that i''m using C++ so if the tuts were about win32 would be best but dos is good i just want to read as much as i can on pallet''s
l8r

##### Share on other sites
16 bit graphics as far as I know does not use pallet''s ie they cant use them (at least not in directx) it would be possible to write your own colour shifiting/animation functions however I cant imagine they''d be very fast.

Sephwrath

##### Share on other sites
Just finished wiriting a fire routine recently.

First of all, I tried to writh the fire routine in 16 bit mode. I was not happy with the colour palette. I couldn''t get enough colours to make it look any good.

I ended up writing it up in 32 bit mode, which could also be done in 24 bit, but the 32 bit was easier to work with.

I constructed my own palette using 768 colours for the routine. Playing around with different pixel averaging, you can get different effects. Like when the wind blows it left or right, a frame timer etc.

This is what I ended up with:

This is a very old, but dependable method.
I also made good use of pointers, and that made the animation go quite quickly. I even got a decent effect by taking the average of only two pixels below the pixel I was calculating for. I believe this worked because of the large colour palette I was working from.

My palette was generated like so:

 // white to yellow - red - black for ( c_loop = 0 ; c_loop < 768 ; c_loop++ )      { Palette [ c_loop ] = FIRE_RGB32( red, green, blue );                if      ( red   <  255 )                  red   ++;        else if ( green <  255 )                  green ++;        else if ( blue  <  255 )                  blue  ++;      }

Writing a fire routine with ye-old pixel averaging method is alot of fun. You can experiment endlessly with it to get the desired effect.

Happy coding, Guy

• ### Forum Statistics

• Total Topics
627733
• Total Posts
2978838

• 10
• 9
• 21
• 14
• 12