Advertisement Jump to content


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


Strange lights

This topic is 5340 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

Does anyone have a good tutorial for setting lights in a scene? I''m struggling with the position and direction of my lights. I''d like them to always be positioned directly looking into the scene. I can''t seem to get them to stay in that position. The lights seem to change as I move scene primitives. Gort...Klaatu, Barada Nikto!

Share this post

Link to post
Share on other sites
are the lights moving or is it just that your objects are moving and their normals are causing them to reflict light due to the angle differently now?

If you always want them positioned into the scene cant you just make them parallel with the camera then(the look at vector)?

Share this post

Link to post
Share on other sites
Are you doing all you math correctly? Run through the code and make sure you aren''t accidentally moving your lights somehow.

Also, what kind of lights are you using? Spot, directional, point? One, some, or all?

I am not too experienced with DX but I think I could help.

Notes on lighting positioning:
Point light:
When setting the position and direction, the direction is meaningless since they shine in all directions. The position is a vector describing the position in world coordinates.
Directional light:
When setting the position and direction, the position is meaningless. Say the sun is being represented by a directional light. In your 3D world, if it were in the +x, +y, -z space and were shining at the origin of the world, the direction of the light would be [-1, -1, +1]. I hope that makes sense.
Spot light:
Think of it as a flashlight. The flashlight has a position (the position) and a direction the light is shining (the direction).

I hope that helps with your struggles with position and direction.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!