sceGuColor functionality discussion - suggest SDK patch

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

sceGuColor functionality discussion - suggest SDK patch

Post by Raphael »

I stumbled upon something when trying to give images constant alpha without specifying it in vertex colors. The obvious idea was to use sceGuColor to set the fragment color, then use sceGuTexFunc(GU_TFX_DECAL, GU_RGB) to let texture color be taken together with fragment alpha.
The result was that the image wasn't blended at all. And if it was, it was always completely invisible. So I started so dig into the functionality of sceGuColor and found that it is currently just a wrapper for sceGuMaterial(7, *), so it just sets the models ambient, diffuse and specular color at once.
However, it doesn't take the colors alpha into account, even though alpha can be supplied with the ambient model color - see sceGuAmbientColor.
So the current solution for getting constant alpha is calling sceGuAmbientColor instead of sceGuColor, but if one wants diffuse/specular lighting to take the same color, you'd need to call sceGuColor AND sceGuAmbientColor.

Now I wonder why that wasn't done - was it a mistake by forgetting about the ambient alpha, or is that on purpose?

My suggestion would be to patch the sceGuColor.c file to also apply the ambient alpha component.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

I looked at the original function and you're right, for the ambient component it also sets the alpha register (88), my bad. Good catch there, I'll patch right away.

EDIT: Patch is now in svn.
EDIT2: Also committed another patch adding sceGuFinishId(), that has been missing since the start.
GE Dominator
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

That was quick :) Thanks chp
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Post Reply