unit vector of angle between 2 vectors
What I''m trying to do is have a directional light always face in the same direction as the camera using D3D 8.1. My camera has a lookAt, lookFrom, up vectors and a projection matrix. The directional light needs a unit or normalized vector. Can I somehow extract the information from the projection matrix or will I need to find the angle between the lookAt/lookFrom vectors and use that come up with a direction vector? I''m obviously new at this math and have been reading vector math stuff all morning but I just cant put the pieces together to accomplish what I want. Please teach me Yoda.
The answer to your question is covered by the DirectX documentation (at least it is in the DX8.1 docs). Look up "Camera Space Transformations." This article provides an equation for Ldir, which is exactly what you''re looking for.
In the future, when asking an API specific equation (D3D, OpenGL), please post the question in the forum for that API.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
In the future, when asking an API specific equation (D3D, OpenGL), please post the question in the forum for that API.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement