flash - perspective projection formula problem -


I am developing 3D flash games and my question is very simple.

How to change the 3D point in 2D point?

I got the next formula in the internet (the camera is located in the original)

  1. X '= X / zy' = y / z
  2. ratio = Focal length / (folkleng + z) x = proportion = y = y * ratio

    But these formulas give me strange results when z is less than zero (z

    I need a line of A (100,100,100) to B (100,100; -100) as you can see this when I try to change the B point in 2D amplitude. The equation is actually a The Ib results

    I can do to solve this problem?

    Keep in mind what this means when z = 0 means that you are x / 0 That's bad - in this case, it means that the point is in the same place as your camera! And as soon as the zodiac becomes small, it means that the digits are running behind your camera, so they should not be rendered at all.

    You want a small ground to be your 'nearest plane' at the back of the screen, say, z = 1 to prevent incorrect rendering, you have to run against this z = 1 aircraft Also have to clip the sketches.

    In the case of the number, you point.z . For lines, it is more complex - you should calculate the intersection of the line with z = 1 plane and clip it if necessary.

    You can find some information on line clipping.

Comments