Perspective Projection

Started by
0 comments, last by yeilam 18 years, 8 months ago
Hi all, When projecting onto a plane at depths z=a, 2a, 3a, 4a, ... the plane placement is linear but distance between points projected onto the planes is not thanks to: sx = (px * f)/pz I need to place n planes between nearz and farz such that the increase in distance between projected points is linear. Can anyone help me? I've been trying to work this out for ages but can't get my head around it. I am sure that the placement must rely upon f in some way which is a function of the field of view and the screen resolution, but I just can't get the formula. I also realise that the planes are closer together when closer to the camera, and get further apart the further away they are. Any help welcome! Thanks!
Advertisement
Perspective projection works like this:
(X-X0)/(Z-Z0) = (U-U0)/F
AND
(Y-Y0)/(Z-Z0) = (V-V0)/F

X,Y, and Z are world coordinates while U,V are screen coordinates
U0 and V0 are the focal center. Usually window_width/2 and window_height/2.
F is the focal distance in pixels and can be found by:
F = window_height /2 / tan(vertical_FOV / 2)
OR
F = window_width /2 / tan(horizontal_FOV / 2)

Hope it helps.
Yigal

This topic is closed to new replies.

Advertisement