world coords to pixel coords

Started by
1 comment, last by Bruno 23 years, 6 months ago
Hi Anyone knows the formula to tranform a world coordinate (x,y,z) into pixel coordinates (x,y) ??? thanks Bruno
Advertisement
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
*clears throat*
http://web2.airmail.net/sjbaker1/projection_abuse.html

This topic is closed to new replies.

Advertisement