0
$\begingroup$

I have some code based on the 3d perspective projection formula I found on wiki.

http://en.wikipedia.org/wiki/3D_projection

It works great... mostly :)

I recently started making the code do z ordering/culling... but I was getting weird results. After a lot of debugging I came to realise my formula for working out the zorder value is wrong.

So... I created this in sketchup.

Perspective Projection

The params I use to do the projection are CoordinateToProject, CameraPosition, CameraRotation, ViewerPosition.

1) What exactly is the formula I need calculate the zorder value/distance, please?

2) Why does my code not support -Z? Is it a most likely a bug in my code or a limitation of the formula?

THANKS :)

Edit: I am now happy with the answer to number 2. I just need to know how to calculate the z order.... any links/help would be appreciated!!!!

1 Answers 1