Screen coords in DirectX
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).
Are you calculating .z-coordinates too?
Usually for facing the other direction .z will be negative.
Usually for facing the other direction .z will be negative.
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?
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement