using materials (generally and specular, and emmisive)?

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Stellar
Posts: 48
Joined: Mon Dec 12, 2005 9:13 am

using materials (generally and specular, and emmisive)?

Post by Stellar »

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: Select all

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
Image
memon
Posts: 63
Joined: Mon Oct 03, 2005 10:51 pm

Post by memon »

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

Code: Select all

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?
User avatar
Stellar
Posts: 48
Joined: Mon Dec 12, 2005 9:13 am

Post by Stellar »

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.
Image
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

sceGuTexEnvColor() is used by sceGuTexFunc() whenever you use GU_TFX_BLEND, much like how OpenGL uses it.
GE Dominator
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

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...
Post Reply