forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

found how to use color function (filtering)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
yoyofr



Joined: 25 Jun 2005
Posts: 23
Location: paris

PostPosted: Tue Jul 26, 2005 6:41 pm    Post subject: found how to use color function (filtering) Reply with quote

Hi,

I'm still playing a lot with GU & found how to use

Code:
sceGuColorFunc(int a0, unsigned int color, int a2);


It's a color filtering function.
a0 is function (GU_EQUAL,GU_LESS,....)
a2 is the color mask

you'll have to acticate color testing & then specify the function in the same way you specify a depth/alpha function.

enable it with :
Code:
sceGuEnable(GU_UNKNOWN_17)

specify a simple function to not render blue pixel :
Code:
sceGuColorFunc(GU_EQUAL,0,0XFF0000)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Tue Jul 26, 2005 11:38 pm    Post subject: Reply with quote

Ah, nice, this could be useful for color-keyed textures and other areas. Good work! I'll add it to GU.

EDIT: Hm, just to understand that correctly... that call would reject any pixel that does not keep the blue channel to 0, right?

EDIT 2: Also, it seems as the function masks the function by 0x03, GU_LESS and above are not available when color testing.
_________________
GE Dominator
Back to top
View user's profile Send private message
yoyofr



Joined: 25 Jun 2005
Posts: 23
Location: paris

PostPosted: Wed Jul 27, 2005 12:20 am    Post subject: Reply with quote

Quote:
Hm, just to understand that correctly... that call would reject any pixel that does not keep the blue channel to 0, right?

exactly.

Quote:
Also, it seems as the function masks the function by 0x03, GU_LESS and above are not available when color testing.

good to know !
In fact I was trying to be able to filter a particular color when I have checked this in order to do adaptive blending. My texture used for blending has a back color (the one filtered) & some pixels resulting from
a previous rendering.
The back color has to be blended using add or sub & the pixels different
from back color have to be blended & then the result has to be divided by 2.
So I blend with a GU_FIX,GU_FIX,0xFFFFFF,0xFFFFFF with color filtering on,
so that only my back color is used. Moreover I setup stencil buffer so that
written are are marked.
Then I blend with a GU_FIX,GU_FIX,0x7F7F7F,0x7F7F7F with color filtering off. Stencil buffer allow me to update only what wasn't updated in first pass.

Now if you can guess why I have to do this, you're pretty smart ;-)
it's not a new game....
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Wed Jul 27, 2005 1:02 am    Post subject: Reply with quote

SNES? :)
Back to top
View user's profile Send private message
laxer3a



Joined: 11 May 2005
Posts: 23

PostPosted: Wed Jul 27, 2005 3:03 am    Post subject: Reply with quote

Yoyofr, it seems that we have been caught and we have a winner here :)
Back to top
View user's profile Send private message
yoyofr



Joined: 25 Jun 2005
Posts: 23
Location: paris

PostPosted: Sun Jul 31, 2005 7:45 pm    Post subject: Reply with quote

hehe, you're smart ector, really :-)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
matkeupon



Joined: 02 Jul 2005
Posts: 26

PostPosted: Mon Aug 01, 2005 5:56 am    Post subject: Reply with quote

Can someone help me with the functions and mask values ??

I'm trying to blit stuff with a transparent color. I use 5551 textures, and only using the rgba test and bilinear filtering, then my transparent color is displayed on edges (I guess because of the filtering, turning it off just works fine).

So I guess I'll need a color test, but I don't get how the function and mask work...

Note that I can set the color value to anything, so you can take any color you want as an example :)
Back to top
View user's profile Send private message
matkeupon



Joined: 02 Jul 2005
Posts: 26

PostPosted: Tue Aug 02, 2005 6:48 am    Post subject: Reply with quote

Don't bother, I figured it out...

sceGuAlphaFunc(GU_GREATER, 0x80, 0xff);

does it fine :)
Back to top
View user's profile Send private message
flipinstyxs



Joined: 03 Aug 2005
Posts: 1

PostPosted: Wed Aug 03, 2005 10:14 am    Post subject: Reply with quote

sorry this doesnt have to do anything with this discussion but i just wanted to thank yoyofr for a job well done on his port of the SNES. i've been reading on some of the blogs you've been posting and i kinda knew the direction of where your talent was going...once again awesome job!...As a matter of fact i'll leave a little something this friday through paypal...hopefully it will buy at least a six pack of beers!
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group