#### Archived

This topic is now archived and is closed to further replies.

# world coords to pixel coords

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

## Recommended Posts

Hi Anyone knows the formula to tranform a world coordinate (x,y,z) into pixel coordinates (x,y) ??? thanks Bruno

##### Share on other sites
1. Transform XYZ to camera space: multiply XYZ by camera matrix.
2. Project XYZ-in-camera-space on screen:
xScreen = ( x / z * focus ) + screenWidth/2;yScreen = ( y / z * focus ) + screenHeight/2;

Where "focus" is some constant, usually close to screenWidth/2.
Or, more exact:
focus = (screenHeight/2) / tan( FOV/2 );

...
Or use projection matrix.

Edited by - Meduzza on October 3, 2000 11:30:39 AM

##### Share on other sites
*clears throat*
[url]http://web2.airmail.net/sjbaker1/projection_abuse.html[/url]

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631722
• Total Posts
3001892
×