Archived

This topic is now archived and is closed to further replies.

Quick Light question

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to figure out how to get my lights working right. I''m fairly sure it has something to do with the attenuation of my light but not quite sure. The light seems "late" to me. I have a cube spinning around, and it takes about a half of a second before the light actually shows up on the faces. So, even though its in direct way of the light, it is dark for about half a second. Here''s my light setup, it might even have nothing to do with this, but I''d like some help:
  
memset(&light,0,sizeof(light));
	light.Type=D3DLIGHT_POINT; //a point light, no direction

	light.Diffuse.r=1.0f; //set the Diffuse color to full white

	light.Diffuse.b=1.0f;
	light.Diffuse.g=1.0f;


	light.Ambient.r=0.0f;
	light.Ambient.b=0.0f;
	light.Ambient.g=0.0f;

	light.Specular.r=0.0f;
	light.Specular.b=0.0f;
	light.Specular.g=0.0f;

	light.Position.x=0.0f; 
	light.Position.y=0.0f;
	light.Position.z=0.0f;
	
	light.Attenuation0=1.0f;
	light.Attenuation1=0.0f;
	light.Attenuation2=0.0f;
	light.Range=100.0f; 
  

Share this post


Link to post
Share on other sites
Do you only have eight vertices in your cube? Remember that lighting is done per-vertex, meaning if you have a big quad and light right in its center, the quad will be black because light is far from its vertices.

Share this post


Link to post
Share on other sites
I think I understand what you are asking me. My cube isn''t as big as you think it is if I get you right. the cube is really small and the light is about 50 units away from it.

Share this post


Link to post
Share on other sites
Ok, I think the problem is that only one side of the cube can be lit at one time. Thats what appears to be the problem. WHY in the world would it be like that?

Share this post


Link to post
Share on other sites