3D projections using Direct3D
May 7, 2007 at 8:45 pm | Posted in direct3D | Leave a commentHi,
It is actually quite easy to do 3D projections using D3D, and it is even easier to do the inverse transform using D3DX10 (which I think it replaces the D3DMath library used in DirectX 7…. but I am not sure at all!)
To do this you can multiply the vectors in this way:
screen = mWorld * mView * mProj * point3D
an for this you can use the D3DXVec3Project method (and to undo this, use the D3DXVec3Unproject )
It is really straight forward and very very easy (if I could, then anyone can do it).
See you
Marcelo
PS: Though, be careful. If your window is not square, then you might be interested to read some articles about “window to viewport mapping”
http://medialab.di.unipi.it/web/IUM/Waterloo/node14.html
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.