   Point Light Attenuation problem.
  Hi,I´m trying to light a mesh with a Point light but it seems that attenuation is not working the way I want.When I use this params: m_pD3DLight=new D3DLIGHT9;ZeroMemory(m_pD3DLight, sizeof(D3DLIGHT9));m_pD3DLight->Position.x   = m_pPosition->x;m_pD3DLight->Position.y   = m_pPosition->y;m_pD3DLight->Position.z   = m_pPosition->z;m_pD3DLight->Diffuse.r=m_pD3DLight->Specular.r=m_pD3DLight->Ambient.r=1.0f;m_pD3DLight->Diffuse.g=m_pD3DLight->Specular.g=m_pD3DLight->Ambient.g=1.0f;m_pD3DLight->Diffuse.b=m_pD3DLight->Specular.b=m_pD3DLight->Ambient.b=1.0f;   m_pD3DLight->Range  = 1000.0f;m_pD3DLight->Type= D3DLIGHT_POINT;m_pD3DLight->Attenuation0=0.0f;m_pD3DLight->Attenuation1=1.0f;m_pD3DLight->Attenuation2=0.0f;nothing is seen but if I change Attenuations values to: m_pD3DLight->Range  = 1000.0f;m_pD3DLight->Type= D3DLIGHT_POINT;m_pD3DLight->Attenuation0=1.0f;m_pD3DLight->Attenuation1=0.0f;m_pD3DLight->Attenuation2=0.0f;the mesh is seen but with no attenuation (as it should be).Does anybody know what is the problem here?Thanks in advance,HexDump.[edited by - HexDump on May 28, 2004 9:18:17 AM]
  Make sure your mesh is not too far away from the light source or the light contribution may be too close to 0 for you to see anything.  Try moving the mesh closer and see if it starts to look better.neneboricua ;  Light is really close (it is a light that travels over a little city between buildings). ANyway, I tested with a greater range value with no luck either.Really weird.HexDump. ;  Nobody has any other idea? HexDump. ;  What do you mean when you said you moved the light close to the object?  Did you really move it close enough, because your attenuation really cuts the light down quick.  Lets do some math. Attenuation of 0,1,0, means light is multiplied by 1/(1*d) or 1/d.  Your range is 1000.At 1000 units away, light is 1/1000 brightness.  255 being your maximum typical brightness, the light will affect these vertices by 255/1000, or 0.25... That''s not visible.At 200 units away, light will contribute 255/200.. We may see an increase of 1 to our RGB values.  Not really noticable.At 20 units away, it''s 255/20, or about 12.  We might notice that, but it''s still not bright.At 4 units away, it''s 255/4... RGB += 64.  Ah, no we''re getting somewhere. 