alpha channel cutoff

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ruspa
Posts: 19
Joined: Thu Sep 13, 2007 11:17 pm
Location: Gorizia, ITALY

alpha channel cutoff

Post by ruspa »

I've achieved enabling transparency on a prog, but I my textures blend like they were in GIF format with 1 color set to transparent, while I'm using png with full alpha channel (I tried on explorer that supports full png transparency and I got the exact per-pixel-alpha blending with whatever I set to background, color, an image..).
Initially I thought that the "pixelated" look of my sprite was due to some bilinear filtering stuff I was missing to implement.. then after a short while I realized that there is an ugly black border all around my soft-blended image border.
Can someone tell me what I miss to plug in my code to enable the full alpha calculation?

ps.: I am in 8888 mode, textures look good, just the transparency looks like gifs

ps2: i enable this: sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA);
my smell tells me the problem may be here.. but don't know how different can be...
ruspa
Posts: 19
Joined: Thu Sep 13, 2007 11:17 pm
Location: Gorizia, ITALY

Post by ruspa »

I'm playing with this line:

sceGuBlendFunc( GU_ADD, GU_FIX, GU_FIX, 0xff888888, 0xff888888 );

this affects the behaviour of the blending. Which are the values I've got to set willing a common, very normal alpha calculation as I get to a paint shop pro new layer?
ruspa
Posts: 19
Joined: Thu Sep 13, 2007 11:17 pm
Location: Gorizia, ITALY

Post by ruspa »

got it, gonna explain beginner-proof (as I am):

1) I was missing this line in the "sceGuEnable(blah blah)" routine..

sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);

in other words this should inform the gpu on how we will the pixel to be blended (in cascade sequence, i noticed *) so parameters are:
1) the operation we want between our lasagna of textures, we can add pixel values, subtract, do other weird things, since we want to have a normal nice looking blending, set this to GU_ADD.
2)blending function for source pixel: here we tell from where pick first member of the calculation of point (1)
3)second member of operation, (destination pixel) this "one minus" seems to me a thing like "calculate the opposite of the value read"
4) optional values from here, in other words looks like one can customize some treshold values of blending, since we don't want to mess up anything (unless you're advanced and willing to insert some special effects) set these values to nil.

It worked for me :D happy like a puppy

p.s. my explanation is horrible and depicts my newbiness for sure, a better explanation (maybe with some of the most common configurations with the visual effect they lead to) would be a great kickstart!
Post Reply