Advertisement Jump to content
Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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 this post

Link to post
Share on other sites
Perspective projection works like this:
(X-X0)/(Z-Z0) = (U-U0)/F
(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)
F = window_width /2 / tan(horizontal_FOV / 2)

Hope it helps.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!