# 3D Mechanics; which plane is in front?

I have figured out all the basic mechanics for simple 3D graphics; I can make things in wireFrame and raycasting.

The poblem comes when I try to work with solid faces; I can't figure exactly how to tell which face/surface/polygon (whatever you call it) is in front! All I need is a simple routine that will tell which of 2 planes is in front of the other as far as which is drawn over the other (keeping in mind that when everything is drawn, it is drawn in terms of it's 2D image of course). If I can just do that, then I can make my own stupid 3D programs.

• Hi,

Why not just use the z-axis coordinates to check which plane is in front ?

: I have figured out all the basic mechanics for simple 3D graphics; I can make things in wireFrame and raycasting.
:
: The poblem comes when I try to work with solid faces; I can't figure exactly how to tell which face/surface/polygon (whatever you call it) is in front! All I need is a simple routine that will tell which of 2 planes is in front of the other as far as which is drawn over the other (keeping in mind that when everything is drawn, it is drawn in terms of it's 2D image of course). If I can just do that, then I can make my own stupid 3D programs.
:

• : Hi,
:
: Why not just use the z-axis coordinates to check which plane is in front ?
:
Because you're not always looking in the z direction!!!

What you need it's simply calculate the length of the vector beetween the camera and the plane. The longer the vector the more far the plane.

nICO

[hr]
[italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
JOHN KEATS