Page 1 of 1

Alpha channel for 2D sprite

Posted: Thu Jul 03, 2008 6:44 pm
by zxtunes.com
This possible?

I view more games which are able it.

Zuma, Bejeweled 2 and more more games.


For me as games developer this main disappointment and a splinter in Pure Basic from the acquaintance to it (3 years ago) and to this day. :cry:

Posted: Thu Jul 03, 2008 6:53 pm
by djes
Why don't you use 3d sprite? Or alphablending effects?

Posted: Thu Jul 03, 2008 6:56 pm
by Kaeru Gaman
he uses 3DSprites atm...

I wonder if Alpha-Transparency is possible with 2D sprites.
some time ago I heard that it was a DX7 issue,
so I hoped it would have been solved in 4.2 with the DX9 subsystem...

Posted: Thu Jul 03, 2008 8:10 pm
by zxtunes.com
Kaeru Gaman wrote:he uses 3DSprites atm...

I wonder if Alpha-Transparency is possible with 2D sprites.
some time ago I heard that it was a DX7 issue,
so I hoped it would have been solved in 4.2 with the DX9 subsystem...
Game for PopCap engine requre DirectX7 and support alpha channel for 2D sprites. So I think it probably and for PureBasic'a.

http://developer.popcap.com/forums/pop_index.php

Posted: Thu Jul 03, 2008 8:47 pm
by Foz
Popcap do something a little different, they use many small textures and animate through boned 2d sprites.

What this means is that very little work can be done for many animations - the trick is to use flat shading for each part, i.e. create the head(s), hands, legs, feet, etc and then use a 2d skeleton to tie all the pieces together.

The effect is that you can have many textures that are tiny (4x4 or 8x8) that are just parts of the whole. Instead of having loads of artists creating a massive library of sprites, the programmer has to make an animation controller to do the equivalent.

Hmmm... maybe I'll put a demo together because it is a very *effective* animation method.

Posted: Sun Jul 06, 2008 5:41 pm
by y3an
Hello,

I was wondering about that. After all the principe "have nothing of wizard",
but on the material side.. :lol: i dont know

I dont know if it can be usefull to you, but here is what i am experimenting as the "informatic profane" i am :


I have try a little thing for that in my prog, for cursors, because i was not able to use StartSpecialFX correctly. (erm)

I just save my graphics with width, height and 256 colors on a file,
Load it in an array when the program runs,
make a small calcul between the pixel's array and the pixel of destination,
and draw the result directly on the videobuffer

I would like to know, search, ask, discover (lol) how to save this array in the video memory, it could be... more intelligent.. than use CPU.. ?

Maybe juste draw the file on the buffer of a "createSprite()",
And takes pixels with "Usebuffer()" instead of the array..

But stays the problem that calculs are made with the CPU (?).. I have no idea of how "deal" directly with the graphic card.

I am wondering if this method is usefull or totaly idiot.
For the moment the calcul is you can not make simplest, and need some conditions to be improved, i dont know if this way will be really usable for a lot of tiles..


Maybe Sprite3D library, that i never used, is just what i need :lol: , but in a certain way it offend me to use it :lol:


Whatever, if you are intresting, i can give you that little function that helps me for the moment.

I hope it's not a totaly weard idea :lol:, advised programmers have certainly an idea of that.

Posted: Sun Jul 06, 2008 7:15 pm
by Kaeru Gaman
writing directly into the video buffer is an approach from DOS times.
in Mode13, I preferred creating a pointer directly out of VidMem start and x and y
and "poking" the pixel directly via *vid = color

nowadays sprites are better, because they are held in the Mem of the VidCard,
and displaying them is an action of the GPU, no need to bother CPU and VidBUS with this work.

the topic of this thread is using 32bit grafix with an Alpha channel as a 2D Sprite
and displaying them with Alpha transparency.

Posted: Sun Jul 06, 2008 9:13 pm
by zxtunes.com
Kaeru Gaman wrote: the topic of this thread is using 32bit grafix with an Alpha channel as a 2D Sprite
and displaying them with Alpha transparency.
16Bit too. This is faster. 8)

Posted: Sun Jul 06, 2008 11:27 pm
by Kaeru Gaman
16bit with alpha transparency?
this does not exist as far as I know.
maybe it's possible for PNG to encode 16bit with alpha,
since it is capable of 48bit RGB and 64bit RGBA,
but 16bit RGBA is not used on PCs