light intensity & model

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

Moderators: cheriff, TyRaNiD

Post Reply
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

light intensity & model

Post by LuMo »

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

Post by chp »

The attenuation factor of a light is controlled by sceGuLightAtt(). The normal way of computing attenuation is as follows:

Code: Select all

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
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

ok will play with those values...

but this does not make any sense to me:

Code: Select all

//color setup
unsigned int colors[4] =
{
	0xffff0000,
	0xff00ff00,
	0xff0000ff,
	0xffff00ff
};

Code: Select all

	//lightning
	sceGuEnable(GU_LIGHTING);
	sceGuEnable(GU_LIGHT0);
	sceGuEnable(GU_LIGHT1);
	sceGuEnable(GU_LIGHT2);
	sceGuEnable(GU_LIGHT3);	

Code: Select all

		// setup a light
		for &#40;int i = 0; i < 4; ++i&#41;
		&#123;
			ScePspFVector3 pos = &#123; cosf&#40;i*&#40;GU_PI/2&#41; + val * &#40;GU_PI/180&#41;&#41; * LIGHT_DISTANCE, 0, sinf&#40;i*&#40;GU_PI/2&#41; + val * &#40;GU_PI/180&#41;&#41; * LIGHT_DISTANCE &#125;;
			sceGuLight&#40;i,GU_POINTLIGHT,GU_DIFFUSE_AND_SPECULAR,&pos&#41;;
			sceGuLightColor&#40;i,GU_DIFFUSE,colors&#91;i&#93;&#41;;
			sceGuLightColor&#40;i,GU_SPECULAR,0xffffffff&#41;;;
			sceGuLightAtt&#40;i,0.0f,1.0f,0.0f&#41;;
		&#125;

		sceGuSpecular&#40;12.0f&#41;;
		sceGuAmbient&#40;0x00222222&#41;;
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
Post Reply