Developing Games on Intel Graphics
Ask us questions and get answers, tips, tweaks & techniques from product and technology experts.
457 Discussions

Matrix Math Help - D3DXMatrixLookAtLH

stephen-smolley
Beginner
227 Views
Hey there,
I needed some help, please. I need a matrix formula that returns the inverse of what D3DXMatrixLookAtLH normally would.
The inverse of this matrix can be used to transform objects to vEyePt and orient them along vLookAt and vUp if the inverse is used. However, using D3DXMatrixInverse is slow.
Here is the formula MSDN defines for D3DXMatrixLookAtLH.
zaxis = normal(At - Eye)
xaxis = normal(cross(Up, zaxis))
yaxis = cross(zaxis, xaxis)
xaxis.x yaxis.x zaxis.x 0
xaxis.y yaxis.y zaxis.y 0
xaxis.z yaxis.z zaxis.z 0
-dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) 1
Thanks in advance!
-Steve
0 Kudos
1 Reply
stephen-smolley
Beginner
227 Views
Figured it out myself. Thanks anyway!
Inverse of D3DXMatrixLookAtLH:
zaxis = normal(At - Eye)
xaxis = normal(cross(Up, zaxis))
yaxis = cross(zaxis, xaxis)
xaxis.x xaxis.y xaxis.z 0
yaxis.x yaxis.y yaxis.z 0
zaxis.x zaxis.y zaxis.z 0
eye.x, eye.y, eye.z, 1
Reply