Alpha channel for 2D sprite

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
zxtunes.com
Enthusiast
Enthusiast
Posts: 375
Joined: Wed Apr 23, 2008 7:51 am
Location: Saint-Petersburg, Russia
Contact:

Alpha channel for 2D sprite

Post 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:
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Why don't you use 3d sprite? Or alphablending effects?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
User avatar
zxtunes.com
Enthusiast
Enthusiast
Posts: 375
Joined: Wed Apr 23, 2008 7:51 am
Location: Saint-Petersburg, Russia
Contact:

Post 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
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post 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.
y3an
User
User
Posts: 56
Joined: Sun Mar 09, 2008 6:06 am

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
User avatar
zxtunes.com
Enthusiast
Enthusiast
Posts: 375
Joined: Wed Apr 23, 2008 7:51 am
Location: Saint-Petersburg, Russia
Contact:

Post 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)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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
oh... and have a nice day.
Post Reply