Screen coords in DirectX

Started by
2 comments, last by Endurion 19 years, 7 months ago
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).
Advertisement
Are you calculating .z-coordinates too?

Usually for facing the other direction .z will be negative.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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 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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement