Sign in to follow this  
spiffycrony

3d to 2d

Recommended Posts

I have rendered a model using directx8 drawprimitive function as a list of triangles. These triangles are in 3d. I want to know the 2d equivalent of the triangle points at which they are drawn on the screen. How do i get the 2d equivalent(screen coordinates) of the 3d points?

Share this post


Link to post
Share on other sites
Edit: I got this all wrong first time.

You should project the vertices manually. The IDirect3DDevice9::ProcessVertices function may come in handy: it will pump a set of vertices through the current vertex shader (in software, I believe). If you're only interested in the positions of the transformed vertices under the FFP, then it may be faster and easier to project them using D3DXVec3Project or to take the direct route:

transformed_vertex = untransformed_vertex * world_matrix * view_matrix * projection_matrix * viewport_matrix.

If you are processing several vertices per frame, then you should calculate the matrix product first, then apply it to the list of untransformed vertices, so as to avoid unnecessary arithmetic.

Admiral

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this