Help with srcfix and dstfix parameters in Blending function.

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

Help with srcfix and dstfix parameters in Blending function.

Post by HexDump »

Hi,

I just figure out how to do color blending (well, someone point me out that sceCopyImage was only a blit and bypasses the 3D pipeline :) ).

The problem now is that I haven´t found a "MODULATE" blending mode for the color blend function, so I used "ADDITIVE". But this, shows things too much bright. Now I´m using ADD but fixing values with the 2 parameters that the blend function has, but I run into another problem, when I put things this way, colors seems to be not the same that the original image, I mean, I´m drawing a keyboard image over a white background and the colors of the image are not the same when blending, I know that they should be more bright becase of the additive blend, but the problem is that they are totally different.

I use this code to build de both fix parameters:

u8 Byte=(u8)(fTrans*0xFF);
u32 KeybFix=Byte<<24 | Byte<<16 | Byte << 8;
u32 BGFix=(255-Byte)<<24 | (255-Byte)<<16 | (255-Byte)<< 8;
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX, KeybFix,BGFix);
sceGuEnable(GU_BLEND);

what this does is given a transparency it calculates the fix value for the dst and the source, it blends ok, but I have the colors problem.

If anyone knows how to set the "MODULATE" mode this will fix all my problems :).

Thanks in advance, and sorry for the long post,
HexDump.
starman2049
Posts: 75
Joined: Mon Sep 19, 2005 5:41 am

Post by starman2049 »

Don't know if this is what you are looking for but:

Code: Select all

sceGuTexFunc&#40;GU_TFX_MODULATE,GU_TCC_RGBA&#41;;
Is something I use.

Keep in mind that Texture Modulation and Blending via vertex colors/lighting are two different but related operations.
HexDump
Posts: 70
Joined: Tue Jun 07, 2005 9:18 pm

Post by HexDump »

Hi starman2049,

If I´m not wrong the sceGuTexFunc is used to blend texture stages, I mean, for multitexturing, etc... If it works like dx or ogl.

So, it won´t have any effect on the final blending -> fragment buffer + frament comming from multitexturing, and this final blending (blending function) does not have MODULATE.

Thanks in advance,
HexDUmp.
Post Reply