Blending...

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

Moderators: cheriff, TyRaNiD

Post Reply
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Blending...

Post by Tinnus »

So, I don't think I understood the sceGuBlendFunc function. How would I go about setting the following modes?

- (Source + Dest) / 2
- Source / 4 + Dest

Basically I want to know how to multiply one or both of the colors by some value. Currently I can only do 1A + 1B or 1A - 1B :P
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

You use alpha. In the first case you should use: GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA and source alpha value of 128. In the second case use GU_SRC_ALPHA, GU_ONE and source alpha of 64. If you are using texture as source color you may want to modulate the color coming from texture with a white color with alpha set to the value you want.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

If it's a fixed value, you don't need to use alpha, you can use GU_FIX constants. Example:

Code: Select all

// (Source+Dest)/2 or Source * 0.5 + Dest * 0.5
sceGuBlendFunc(GU_ADD,GU_FIX,GU_FIX,GU_COLOR(0.5f,0.5f,0.5f,0),GU_COLOR(0.5f,0.5f,0.5f,0));

Code: Select all

// Source / 4 + Dest or Source * 0.25 + Dest
sceGuBlendFunc(GU_ADD,GU_FIX,GU_FIX,GU_COLOR(0.25f,0.25f,0.25f,0),GU_COLOR(1,1,1,0));
GE Dominator
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Post by Tinnus »

Ah, I knew the FIX thing was for something like that. Thanks a lot :)
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
Post Reply