Sign in to follow this  

XNA,how to convert 3d world coordinate into screen coordinate

This topic is 2591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could someone know how to convert 3D world coordinate into screen coordinate?

First method:
1.create vertex buffer and set vertex coordinate with a 3D point of certain poistion
2.set basic effect with world matrix,view matrix,projection matrix individullay
3.draw the 3D point

Second method:
1.create vertex buffer
2.transform the 3D point of certain position with world matrix*vie matrix*projection matrix
3.set vertex coordinate of vertex buffer with transformed 3D Vector3(step2)
4.set basic effect's world matrix, view matrix and projection matrix with Matrix.Identity
4.draw the 3D point

I know the first method is correct. But the result the second method is incorrected. Because the transformed Vector3 is outside of camera, event it should in the camera view.

Share this post


Link to post
Share on other sites

This topic is 2591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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