world coords to pixel coords
Hi
Anyone knows the formula to tranform a world coordinate (x,y,z) into pixel coordinates (x,y) ???
thanks
Bruno
1. Transform XYZ to camera space: multiply XYZ by camera matrix.
2. Project XYZ-in-camera-space on screen:
Where "focus" is some constant, usually close to screenWidth/2.
Or, more exact:
...
Or use projection matrix.
Edited by - Meduzza on October 3, 2000 11:30:39 AM
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement