Jump to content
  • Advertisement
Sign in to follow this  
bensta00

Perspective Projection

This topic is 4837 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
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

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!