 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Tue Jan 10, 2006 12:55 am Post subject: light intensity & model |
|
|
how can i set the intensity of a light?
or the radius?
further, how can i move the model instead of the camera?
Thanks in Advance
lumo
PS: ambient color makes whole set lighter...
i am testing with the settings from lights sample...
4 lights there, but only one shows up _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Tue Jan 10, 2006 3:37 am Post subject: |
|
|
The attenuation factor of a light is controlled by sceGuLightAtt(). The normal way of computing attenuation is as follows: | Code: |
attenuation = 1 / (atten0 + atten1 * distance + atten2 * (distance*d * distance))
| and this should map to sceGuLightAtt(). Using PSPGL, you use glLightfv() with GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION and GL_QUADRATIC_ATTENUATION.
As for transforming the object, if you use GUM or PSPGL, you simply store the inverse of the camera (also known as a view) as the root matrix on the view-stack, push those values on the matrix stack and then transform the object in question. _________________ GE Dominator |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Tue Jan 10, 2006 6:25 am Post subject: |
|
|
ok will play with those values...
but this does not make any sense to me:
| Code: | //color setup
unsigned int colors[4] =
{
0xffff0000,
0xff00ff00,
0xff0000ff,
0xffff00ff
}; |
| Code: | //lightning
sceGuEnable(GU_LIGHTING);
sceGuEnable(GU_LIGHT0);
sceGuEnable(GU_LIGHT1);
sceGuEnable(GU_LIGHT2);
sceGuEnable(GU_LIGHT3); |
| Code: | // setup a light
for (int i = 0; i < 4; ++i)
{
ScePspFVector3 pos = { cosf(i*(GU_PI/2) + val * (GU_PI/180)) * LIGHT_DISTANCE, 0, sinf(i*(GU_PI/2) + val * (GU_PI/180)) * LIGHT_DISTANCE };
sceGuLight(i,GU_POINTLIGHT,GU_DIFFUSE_AND_SPECULAR,&pos);
sceGuLightColor(i,GU_DIFFUSE,colors[i]);
sceGuLightColor(i,GU_SPECULAR,0xffffffff);;
sceGuLightAtt(i,0.0f,1.0f,0.0f);
}
sceGuSpecular(12.0f);
sceGuAmbient(0x00222222); |
shouldn't create this code 4 lights?
when i compile it i only get ONE white light!
greets
lumo _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
|
|
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
|