| View previous topic :: View next topic |
| Author |
Message |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Sun Mar 12, 2006 9:18 pm Post subject: Alpha channel copy |
|
|
Hello,
I have an image (drawbuffer) that for example is filled with: 0x00000000.
I want to fill this image with for example: 0xff808080.
The alpha channel seems not to be copied to the destination, even if alpha-blending is turned off, so here I'll have 0x00808080 on the dest buffer if I draw a 0xff808080-colored poly on it or do sceGuClear.
Does anybody know how I could copy alpha channel as well as colors to the destbuffer when drawing?
Thanks in advance _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Sun Mar 12, 2006 10:31 pm Post subject: |
|
|
| Did you set sceGuTexMode(GU_TX_REPLACE,GU_RGBA) so that destination alpha is set correctly? |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Sun Mar 12, 2006 11:28 pm Post subject: |
|
|
Yes, but it didn't changed anything. Maybe there is something else I missed? _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Mar 13, 2006 3:58 am Post subject: |
|
|
| Well I'd need to peek at your setup- & drawingcode to get the problem. Most likely it's something really simple |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Tue Mar 14, 2006 9:49 pm Post subject: |
|
|
Hm I don't have my code here, sorry, but I took some GU samples for testing (spharm for example) and in all cases, alpha was not stored to the destination.
The problem is that in normal situation, alpha is never stored to the destination buffer. It's just used for blending. So in my case it seems that when blending is disabled, alpha information is just lost (unuseful).
So there might be something else to enable in the GE so that alpha is copied to the dest buffer?
Thank you in advance :) _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
memon
Joined: 03 Oct 2005 Posts: 63
|
Posted: Tue Mar 14, 2006 11:15 pm Post subject: |
|
|
| Do you enable stencil buffer? I think you can either use destination alpha or stencil buffer since they share the same memory. |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Wed Mar 15, 2006 4:58 am Post subject: |
|
|
Yes thanks, this actually works for clearing the destbuffer, but it doesn't if I want to draw images (or I didn't understand stencil doc correctly).
I found a workaround, which is to set the stencil buffer to 0, then every drawn pixel replaces stencil value with 0xff (alpha test -> only nonzero-alpha pixels are drawn). Then drawn pixels will be opaque, the rest will be transparent. But this is not a very satisfying alternative, as it's really limited :(
Is there any alternative for writing alpha to the destbuffer?
Thanks in advance _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Mon Mar 12, 2007 11:47 am Post subject: |
|
|
I have the very same problem, I need to render to the alphachannel and it seems not to work, it does work for clearing, but I need it during usual rendering.
here: http://forums.ps2dev.org/viewtopic.php?t=6648&highlight=alpha+channel someone seemed to get it working.
so does anyone know the magic difference to get it work? |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Mar 12, 2007 5:09 pm Post subject: |
|
|
| Quote: | | By the way: the framebuffer's alpha DOES get filled, provided you use GU_TCC_RGBA with sceGuTexFunc. |
Probably that? At least I can confirm that rendering alpha to destination IS possible, though I didn't specifically test it. It was rather an (unwanted) side-effect that I noticed in my last 32bit TGA screenshot. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Mon Mar 12, 2007 5:39 pm Post subject: |
|
|
| Raphael wrote: | | Quote: | | By the way: the framebuffer's alpha DOES get filled, provided you use GU_TCC_RGBA with sceGuTexFunc. | Probably that? |
| Brunni wrote: | | Yes, but it didn't changed anything. Maybe there is something else I missed? |
so I guess there is something more to set to get it running. when I was running my test, the alpha did not change at all during rendering (so not even just "black" alphavalues were set).
| Quote: |
At least I can confirm that rendering alpha to destination IS possible, though I didn't specifically test it. It was rather an (unwanted) side-effect that I noticed in my last 32bit TGA screenshot. | would be nice if someone could post some source, this would help a lot to find that difference. |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Mon Mar 12, 2007 7:16 pm Post subject: |
|
|
Note that the alpha byte in the framebuffer gets filled with random values since firmware 2.5, as a countermeasure against exploits that use code loaded in the framebuffer.
(Actually, it might not be random, it might just be 0 - I don't remember exactly.) _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Mar 12, 2007 9:24 pm Post subject: |
|
|
But only in VSH I suppose? Because in games etc. the framebuffer alpha is supposed to hold the stencil bits if stenciling is enabled, so it would be bad if they just wrote over those bits in any unpredictable (to the game app) way. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Tue Mar 13, 2007 10:32 am Post subject: |
|
|
True, I would imagine this only applies to wallpaper in VSH. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Sat Mar 31, 2007 11:36 pm Post subject: |
|
|
| Raphael wrote: | | Quote: | | By the way: the framebuffer's alpha DOES get filled, provided you use GU_TCC_RGBA with sceGuTexFunc. |
Probably that? At least I can confirm that rendering alpha to destination IS possible, though I didn't specifically test it. It was rather an (unwanted) side-effect that I noticed in my last 32bit TGA screenshot. |
Same as rapso: impossible to get it working (and I created this topic 1 year ago: you can imagine I've tried a LOT of things since this).
I tried GU_TCC_RGBA, but it doesn't work. I've tried a lot of things, but alpha NEVER gets filled :(
You say that you got it working, but can you please post a sample with source code? Please (I'm getting crazy)... _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
|