Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem About 3D Projection?

I've Been Trying To Make A 3d renderer software (just trying for learning purposes) so when i read this article : http://en.wikipedia.org/wiki/3D_projection#Perspective_projection I Get Confused With The Part About ( e ) which is the viewer's position relative to the display surface , and i dont understand what does that mean or how can i calculate it, so please help and tell me the diffrence between it and camera position

Thanks In Advance,

Omar Emad Eldin

like image 247
Omar Emad Eldin Avatar asked Mar 09 '26 16:03

Omar Emad Eldin


1 Answers

If you'll forgive me opening with a copy and paste, e is the viewer's position relative to the display surface. So in the case of computer graphics it's the vector from a defined point on the screen (the centre of projection, most usefully) to the person looking at the screen (who we're pretending is a single point).

You normally can't calculate it, because even if you assume you have only one person looking at the screen, you probably know where they're sitting. Sometimes you can track eyes through a webcam or something else like that but usually you can't.

Once you have a point (x, y, z) relative to the camera, most libraries just do the following calculation to work out where to put the point in screen space:

x' = (half width of viewport) * x / z
y' = (half height of viewport) * y / z

Which assumes the viewer is positioned centrally and one unit back from the screen, given that the position in camera space has already been scaled to apply some given horizontal and vertical field of view. I'm also taking the origin to be in the centre of the screen.

like image 188
Tommy Avatar answered Mar 12 '26 09:03

Tommy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!