Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Talking BasicEffects, where is the source of the three directional lights?

When I write this:

effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0, 0); // a red light
effect.DirectionalLight0.Direction = new Vector3(1, 0, 0);

What does it mean for the direction? From where is it directing?

share|improve this question

1 Answer 1

Directional lights have no position. Think of the sun lighting objects on earth. Technically it has a position, but it is so far away that it does not matter.

Therefore a directional light will illuminate based only on the angle between the light's direction and the surface normal.

If you want lights with a position that also have attenuation, you want to use point lights.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.