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 

using materials (generally and specular, and emmisive)?

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



Joined: 12 Dec 2005
Posts: 48

PostPosted: Sun Jan 15, 2006 4:03 am    Post subject: using materials (generally and specular, and emmisive)? Reply with quote

im porting my model class, and right now im working with materials. i've made a list of material attributes and the gu functions which i believe are relavent ( if im wronge, please correct me ^^ ).

so here are my questions...

1) How do i set a specular for a material, i've seen it for lights, which confuses me, because if you shine a flashlight at a polished table and again at a brick wall, its the table and the wall that contain the ability for specular hilights, not the light itself? I must misunderstand the implementation.

2) How can emmissive materials work? if i want a ball that glows in the dark?

Code:

these are just some assoications ive made thus far

Diffuse           | sceGumDrawArray->GU_COLOR_#### | sceGuColorMaterial
Enviornment Color | sceGuTexEnvColor
Ambient           | sceGuAmbientColor              | sceGuColorMaterial
Specular          |                                | sceGuColorMaterial
Specular Power    | sceGuSpecular
Emmissive         |
Alpha             | sceGuBlendFunc


thanks again guys, its great to be apart of these boards, im very eager to contribute when im more comfortable with the api.

later,
-stellar
_________________
Back to top
View user's profile Send private message
memon



Joined: 03 Oct 2005
Posts: 63

PostPosted: Sun Jan 15, 2006 7:53 am    Post subject: Reply with quote

There are two (undocumented) functions in the pspgu header file:

Code:
void sceGuMaterial(int mode, int color);
void sceGuModelColor(unsigned int emissive, unsigned int ambient, unsigned int diffuse, unsigned int specular);


I have not tested them, but here's my educated guess.

The sceGuMaterial allows to set diffuse, ambient or specular color. Or any of the combinations at the same time (for some reason the emissive color is missing here).

Alternatively you can specify them all in one go using the sceGuModelColor. It does not really matter which one you use.

Other than that I would guess that the PSP lighting stuff is very much like OpenGL. For more details see some OpenGL documentation.

Based on your list I think you are not familiar with the ColorMaterial. Color material means that ambient, diffuse or specular (or any combination) color is replaced with vertex color. If the color material is not enabled when the colors set by sceGuMaterial or sceGuModelColor are used for all the polygons.

(Now that I look at the gu header documentation I hope I'm not wrong with the previous statement. If I call sceGuColorMaterial(0) does it disable the color material?)

sceGuAmbient is used to set amount of the global ambient light and sceGuAmbientColor on the other hand sets the ambient material color. The sceGuAmbientColor seems to be the same as sceGuMaterial with proper flag set, but in addition the sceGuAmbientColor sets the alpha value too. The material setup functions seem a bit incoherent to me.

What do you mean by the enviroment color?
Back to top
View user's profile Send private message
Stellar



Joined: 12 Dec 2005
Posts: 48

PostPosted: Sun Jan 15, 2006 2:04 pm    Post subject: Reply with quote

momon:

thanks for your reply, im going to start messing around with those functions and my Model class to see what i can come up with.

enviroment color? Besides that i spelled it wronge, I dunno, it was just one of the functions i found in the material section. sceGuTexEnvColor( ), aparently is has to do more with textures than materials. probably it accents a texture by blending in a specified color.
_________________
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Sun Jan 15, 2006 8:32 pm    Post subject: Reply with quote

sceGuTexEnvColor() is used by sceGuTexFunc() whenever you use GU_TFX_BLEND, much like how OpenGL uses it.
_________________
GE Dominator
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Mon Jan 16, 2006 11:30 am    Post subject: Reply with quote

I think PSPGL's lighting is pretty much complete with respect to OpenGL, so look at how it uses these registers to do its thing. Of course, it could always use some more testing...

Edit: I haven't implemented glColorMaterial yet, so I haven't checked to see if the similarly named GU function actually works like glColorMaterial...
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