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 

sceGuColor functionality discussion - suggest SDK patch

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



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Thu Mar 01, 2007 7:45 am    Post subject: sceGuColor functionality discussion - suggest SDK patch Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Thu Mar 01, 2007 8:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Thu Mar 01, 2007 6:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
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