best way to do fire under 16 - 32bit ???

Started by
9 comments, last by baddrizz 22 years, 1 month ago
hello again well like the topic says i''m looking for idea''s or code to look over that''ll help me learn how to do the fire effect in 16 24 or 32bit color i''v found lots of fire demo''s in 256colors but they don''t really help much cause i''m a newbie and don''t know how to use palette''s in win32 or ddraw i''v done some stuff in 16bit but nothing special, i''m hopping to learn the fire effect so i can move on to bigger effects like water or bump mapping in 16bit thx for any help
Advertisement
Use particles... (not available for newb''s thoo)


''Qui habet aures audiendi audiat'' - Me

A link to the website of my 3D engine will follow as soon as I have something concrete to show... Which will be soon.
There''s an example about half way down the page here

http://www.gametutorials.com/Tutorials/Win32/Win32_Pg3.htm
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
You could make a fire texture and use some variation of the sine funcion to make the fire texture wave (like a flag). Then use billboarding to keep it facing the player.
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
try this, it is my Firetut. It is in Czech, but it isn'' so important)). here.
quote:Original post by Y2Kbug
here.

Just fixing the link.

"Connection refused"

Edited by - lessbread on February 22, 2002 3:24:11 PM
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
simple, you just need to do the EXACT same algorithm. ie.

1. seed bottom of screen with hot color
2. soften the screen
3. fade the screen to black (or use a larger pallete and do lookups)
4. repeat

I just threw this togeather rather hastily:

Another Fire Tutorial

Guy
I''ve made a REALLY good-looking fire using OpenGL to draw it. If you''re interested, just give me an E-Mail. I really suggest you to look at it . Complete sourcecode, excutable, project files etc...
Well, I guess if you want to use 256 colors examples than just use!!! You said you didn''t know how to deal with pallets... well you will know how to deal with *your* own pallete I guess. So just create a 8bit bitmap... and then look at a pallet for the colours you have to draw each pixel. I never wrote such a code (since I use allegro and it''s all pretty much done) but I guess you can do something like this:

int a;

typedef struct{
unsigned char r,g,b;
} rgb;
rgb pallete[256];

unsigned char bitmap8bpc[YOUR 8bit BITMAP WIDTH SIZE][YOUR 8bit BITMAP HEIGHT SIZE];

then you fill the pallete with the Red Green Blue values so that you create the color gradient for your fire. ex:
for (a=0;a<256;a++)
{
pallete
just do a loop that goes through the ''bitmap8bc'' and draw the pixels! something like this will work (I guess)(it suposes you are only gonna draw ''bitmap8bc'' using it, but you can change it if you want):

void blit8bits (x,y) /*draws ''bitmap8bpc'' to x,y position*/
{
int a,b,xa,ya,colour;
for (a=0;a{
for (b=0;b {
/*here i''m supposing you have a "color creation" routine ready for the colour bit you are using, just replace the hypothetic "create colour(r,g,b)" with it*/
colour = create_colour (pallete[bitmap8bpc[a]].r,pallete[bitmap8bpc[a]].g,pallete[bitmap8bpc[a]].b);<br> /*and then use your ''putpixel(x,y,colur)'' like routine*/<br> xa=a+x;ya=b+y;<br> putpixel (xa,ya,colour);<br> }<br>}<br><br>}<br><br>I guess that''s about it… if you don''t wan''t to have so much work just try using allegro (http://www.talula.demon.co.uk/allegro/)<br>because it does all the "hard work" like this…<br><br>I hope it helps a bit….<br>keep in mind I wrote it pretty fast and didn''t quit look back for mistakes… </b> ' Target=_Blank>Link</a>

This topic is closed to new replies.

Advertisement