Hardware color blending.

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

Moderators: cheriff, TyRaNiD

Post Reply
HexDump
Posts: 70
Joined: Tue Jun 07, 2005 9:18 pm

Hardware color blending.

Post by HexDump »

Hi,

First of all, I have been looking through the forums about hardware color blending (in pspsdk samples too, with no luck).

What I want to do is simple, I have a texture , and I want to render it with color blending onto the back buffer.

I use sceCopyImage to transfer the image to the backbuffer, but I allways get the final image without blend, I mean, the image that is supposed to be blended with the background overlaps the background. I use this code to set up the blending:

1)Context initialization
3)Image copy to back buffer
2)Blending function setup and enable blending state

sceGuBlendFunc(GU_ADD,GU_SRC_COLOR,ONE_MINUS_DST_COLOR,0,0)
sceGuEnable(GU_BLEND);

3) call to sceGuCopyImage() -> to copy texture over the BG Image with colorblend.

4) Disable blending

sceGuEnable(GU_BLEND);


I´m using 5650 color space.

Thanks in advance,
HexDump.
Garak
Posts: 46
Joined: Wed Jul 27, 2005 1:59 am

Post by Garak »

Hello,

I believe sceGuCopyImage() can only be used to copy the RGB data of an image to VRAM. It will not allow you to use any type of alpha blending or transperancy features.

Garak
HexDump
Posts: 70
Joined: Tue Jun 07, 2005 9:18 pm

Post by HexDump »

Can anyone confirm garak belevings please?.


HexDump.
cheriff
Regular
Posts: 258
Joined: Wed Jun 23, 2004 5:35 pm
Location: Sydney.au

Post by cheriff »

Whilst I can't say for sure, but it sounds like he is correct (and this is indeed how it works on ps2)..
I would imagine a function sceGuCopyImage() would only copy an image.. ie blit it straight into vram. If you choose to copy it into a screen buffer then it's not suprising that there's no blending - it is a straight 'copy' operation and would bypass the actual pipeline that does blending and other effects.

I guess what you want it to sceGuCopyImage() it somwhere offscreen, then use a sprite (or some other primitive) to actually render it onto the display. That way you can get blending and things like that.
Damn, I need a decent signature!
HexDump
Posts: 70
Joined: Tue Jun 07, 2005 9:18 pm

Post by HexDump »

Well, I thought I saw that in some place, perhaps I was slippy :). Thanks to both.


HexDump.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Indeed, sceGuCopyImage() is a simple bitblock-transfer, use the normal rendering pipeline if you want to do anything else than a blit.
GE Dominator
Post Reply