Perspective Projection

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

Recommended Posts

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!

Share on other sites
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

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• Forum Statistics

• Total Topics
634111
• Total Posts
3015573
×