Sign in to follow this  
lordarkam

Screen coords in DirectX

Recommended Posts

Which is the faster way to calculate the screen coords of an object using DirectX? I write my own code but I´ve some problems with it. Basically I detect the same screen coords when the camera is facing towards the object and it´s visible (right) and when the camera is facing back the object (wrong).

Share this post


Link to post
Share on other sites
Thanks a lot. I´m testing if .z is less than 1.0 and it works.
It´s not exactly the negative test that you tell me, but if it works, it´s good :D

I´m not sure why, but when you facing the object .z values are smaller than 1.0 while when you are facing back the .z values are bigger. Any suggestion about it?

Share this post


Link to post
Share on other sites
It probably depends on your code too.

Usually after a full coordinate projection coordinates should be in a "box" of X [-1.0, 1.0], Y[-1.0, 1.0] and Z(0.0, 1.0f).
I'm not completely sure about the values, but i remember having the same problem with picking and it worked when i dismissed objects which gave me negative .z.

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