Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Converting World Space to Screen coordinates?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
lolOkayBailolOkayBailolOk
Master Cheater
Reputation: 1

Joined: 23 Jun 2007
Posts: 307

PostPosted: Mon Aug 02, 2010 6:33 pm    Post subject: Converting World Space to Screen coordinates? Reply with quote

I have been playing several FPS games now, most of which I have been able to find the following information:

* Pitch, yaw, roll (of my character)
* X, Y, Z (of my character)
* X, Y, Z (of enemy)
* Name of enemy (and usually will find his health, armor, ammo, etc near the name)


With a little modifications, I usually have a simple (not accurate, but simple) aimbot use all of the above information. I never actually used anything from D3D API to display or change anything in a game (for the Direct3D games of course).

However I want to display the name of enemies with text on the enemy position. Now for 2D games I find this extremely simple ((1366 * enemyX) / gameWidth) = Screen X coordinate, 1366 is a constant for my screen width)

But 3D games have X, Y, and Z. How would I find the the required screen coordinates if I have there world space coordinates?

(Would I need "Camera FOV" or Camera coordinates, I haven't been able to find FOV for any game but camera coordinates should correspond somewhere close the player coordinates I assume)

(Sorry if this post may seem vague, or if the answer is a simple calculation)

Here is a picture of what I mean:
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Aug 02, 2010 7:33 pm    Post subject: Reply with quote

Object space -> World space -> View space -> Projection, (clip then homogeneous, as in normalized -1 to 1) -> Screen space


The D3DX library provides all the functions you need to build the matrices
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Mon Aug 02, 2010 8:34 pm    Post subject: Reply with quote

Slovach's suggestion to use a projection transformation is correct, but there are many different approaches to projection. You can get an easy approximation by simply disregarding the depth and applying scalar factors to compensate for screen dimensions. Beyond that, you can do more complex projections with a little trig and an imaginary wall in front of your player on which to project the labels. You find the intersection of a ray between the player and your plane (frustrum), and that's where you draw your label. The field of view is defined by the clipping rectangle that your game's viewable screen intersects with your frustrum.

Cheers,
adude
Back to top
View user's profile Send private message
lolOkayBailolOkayBailolOk
Master Cheater
Reputation: 1

Joined: 23 Jun 2007
Posts: 307

PostPosted: Tue Aug 03, 2010 11:58 am    Post subject: Reply with quote

Thanks for the input guys! Really appreciate it.

First test:
http://www.youtube.com/watch?v=mCJEDY5WQ1U
(The ESP completely blanks when behind a wall, but I have an idea to prevent this occlusion)

Now I'm going to do some adjusting and find the rest of the NPCs.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Aug 03, 2010 1:30 pm    Post subject: Reply with quote

Not sure what you mean by ESP getting blanked out, is the problem in the video?
Back to top
View user's profile Send private message
lolOkayBailolOkayBailolOk
Master Cheater
Reputation: 1

Joined: 23 Jun 2007
Posts: 307

PostPosted: Tue Aug 03, 2010 2:45 pm    Post subject: Reply with quote

Sorry for my English Very Happy

I mean the models and text are hidden when I face a wall with greater depth then the surrounding walls.

Here is what I mean:
http://www.youtube.com/watch?v=JDamgtZf0N8

I'm suspecting occlusion, and my theory was to do not render depth but that doesn't solve it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites