forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

alpha channel cutoff

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ruspa



Joined: 13 Sep 2007
Posts: 19
Location: Gorizia, ITALY

PostPosted: Sun Sep 16, 2007 11:35 am    Post subject: alpha channel cutoff Reply with quote

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...
Back to top
View user's profile Send private message
ruspa



Joined: 13 Sep 2007
Posts: 19
Location: Gorizia, ITALY

PostPosted: Sun Sep 16, 2007 12:12 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
ruspa



Joined: 13 Sep 2007
Posts: 19
Location: Gorizia, ITALY

PostPosted: Sun Sep 16, 2007 12:56 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group