Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
486 Discussions

Matrix Math Help - D3DXMatrixLookAtLH

stephen-smolley
551 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
551 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
0 Kudos
Reply