Hello,
I have a problem, in my library that I would like to keep as simple as possible, an alpha channel with 0 is represented as opaque and 1 as transparent, contrarily to the PSP default, so that drawing an opaque rect will use RGB(1,2,3) colors, not RGBA(1,2,3, 0xff).
But here's the problem, using 5650 pixelformat, alpha will be returned as '1' by the PSP, so that the image is always opaque, but in my case it means transparent, and the image will not be drawn...
So, is there a possiblity of inverting directly the alpha channel without such problems? I've tried anything with sceGuBlendFunc but no way :(
Thank you :)
Inverting alpha channel
Inverting alpha channel
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Code: Select all
// option1
sceGuAlphaFunc(GU_LESS,0xff,0xff);
sceGuEnable(GU_ALPHA_TEST);
//option2
sceGuEnable(GU_BLEND);
sceGuBlendFunc(GU_ADD, GU_ONE_MINUS_SRC_ALPHA, GU_SRC_ALPHA, 0, 0);
Thank you for your reply.
But unhopefully it won't work for 5650 mode, as alpha is returned as 1, so if you test if alpha < 255, it will always be 255 and never drawn, and with GU_ONE_MINUS_SRC_ALPHA, GU_SRC_ALPHA, it will do 0*texture+1*dst, so never drawn :(
And is there a possibility to do standard alpha blend with this? I tried but the only thing to do is alpha testing, and it will work only for 255 values...
But unhopefully it won't work for 5650 mode, as alpha is returned as 1, so if you test if alpha < 255, it will always be 255 and never drawn, and with GU_ONE_MINUS_SRC_ALPHA, GU_SRC_ALPHA, it will do 0*texture+1*dst, so never drawn :(
And is there a possibility to do standard alpha blend with this? I tried but the only thing to do is alpha testing, and it will work only for 255 values...
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
well, without an alpha value it will be kind of hard ;)
maybe use another texture format?
if you want differentiated blending (more than just 0,1) you will have to use a texture format that allows to store more values for the alpha component
edit
----
to make it clear:
GU_PSM_5650 -> no space for alpha, hence no blending or testing
GU_PSM_5551 -> 1bit for alpha (0||1), so you could do a simple alpha test
GU_PSM_8888 -> 8bits for alpha -> 256 different levels of blending
maybe use another texture format?
if you want differentiated blending (more than just 0,1) you will have to use a texture format that allows to store more values for the alpha component
edit
----
to make it clear:
GU_PSM_5650 -> no space for alpha, hence no blending or testing
GU_PSM_5551 -> 1bit for alpha (0||1), so you could do a simple alpha test
GU_PSM_8888 -> 8bits for alpha -> 256 different levels of blending
Ok thanks, so I'll just disable alpha test/blending in 5650 mode.
Another question related to this, I want to do for example: x*(1-asrc)*csrc+y*(1-adst)*cdst with custom x and y values so that semi transparency is possible.
This can be done with standard alpha (that is, x*asrc*csrc+y*adst*cdst), but I didn't find if it was possible to do it with an inverted alpha value, so for example if my alpha channel is 0x80 (semi transparent), it would then be 0xc0 (3/4 transparent) with the operation.
Is there a possibility to do such an operation?
Thanks in advance
Another question related to this, I want to do for example: x*(1-asrc)*csrc+y*(1-adst)*cdst with custom x and y values so that semi transparency is possible.
This can be done with standard alpha (that is, x*asrc*csrc+y*adst*cdst), but I didn't find if it was possible to do it with an inverted alpha value, so for example if my alpha channel is 0x80 (semi transparent), it would then be 0xc0 (3/4 transparent) with the operation.
Is there a possibility to do such an operation?
Thanks in advance
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released