Site Stability Read more... ×

# 3d point - perspective projection

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

## Recommended Posts

hi..
I wrote an equation to calculate a 3d point's projection
98% of the time this equation works, but it's crucial that it will work 100% of the time.
here's what I got:
first we define some vars. eye -> 3D point for our point of view of the scene point -> 3D point that we want to project on the screen p2d -> our point after projection I assume that on screen, Z = 0, therefore: 0 = point.z + u * (eye.z - point.z) u = -point.z / ( eye.z - point.z ) p2d.x = point.x + u * (eye.x - point.x) p2d.y = point.y + u * (eye.y - point.y) 

this is an image when it's ok:
http://postimage.org/image/bss2e9gcl/
this is an image when it's bad:
http://postimage.org/image/t4sezp9tx/

just to make sure you see it, in the "bad" picture, you can see that one corner of the table moves to a different place
which makes the table look bad...

any idea why this happens?

also, is there another way of doing this without changing my axes?

##### Share on other sites
See here for a derivation of the perspective projection formulas.

I tried to read your derivation, but could not understand it very well. One thing I noted is that u = -point.z / ( eye.z - point.z ) can cause a division by zero, and that you don't seem to be using the concepts of a near plane and an eye (observer) point (or they are somehow hidden implicitly in your derivation).

##### Share on other sites
what I did is a 3D-Line equation (and I split it into x,y,z )

(x, y, z) = point + t * ( eye - point )
to solve the equation I decided that Z=0 (since Z=0 on screen)

btw thanks for the link, I think I'll manage from here

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 15
• 21
• 26
• 11