| View previous topic :: View next topic |
| Author |
Message |
yoyofr
Joined: 25 Jun 2005 Posts: 23 Location: paris
|
Posted: Tue Jul 26, 2005 6:41 pm Post subject: found how to use color function (filtering) |
|
|
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 |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Tue Jul 26, 2005 11:38 pm Post subject: |
|
|
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 |
|
 |
yoyofr
Joined: 25 Jun 2005 Posts: 23 Location: paris
|
Posted: Wed Jul 27, 2005 12:20 am Post subject: |
|
|
| 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 |
|
 |
ector
Joined: 12 May 2005 Posts: 195
|
Posted: Wed Jul 27, 2005 1:02 am Post subject: |
|
|
| SNES? :) |
|
| Back to top |
|
 |
laxer3a
Joined: 11 May 2005 Posts: 23
|
Posted: Wed Jul 27, 2005 3:03 am Post subject: |
|
|
| Yoyofr, it seems that we have been caught and we have a winner here :) |
|
| Back to top |
|
 |
yoyofr
Joined: 25 Jun 2005 Posts: 23 Location: paris
|
Posted: Sun Jul 31, 2005 7:45 pm Post subject: |
|
|
| hehe, you're smart ector, really :-) |
|
| Back to top |
|
 |
matkeupon
Joined: 02 Jul 2005 Posts: 26
|
Posted: Mon Aug 01, 2005 5:56 am Post subject: |
|
|
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 |
|
 |
matkeupon
Joined: 02 Jul 2005 Posts: 26
|
Posted: Tue Aug 02, 2005 6:48 am Post subject: |
|
|
Don't bother, I figured it out...
sceGuAlphaFunc(GU_GREATER, 0x80, 0xff);
does it fine :) |
|
| Back to top |
|
 |
flipinstyxs
Joined: 03 Aug 2005 Posts: 1
|
Posted: Wed Aug 03, 2005 10:14 am Post subject: |
|
|
| 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 |
|
 |
|