I am having a problem with depth sorting in a 3D environment... I have tried numerous approaches but come across problems with certain situations.
My current method involves finding the z value of an objects point furthest from the camera and sorting objects by that depth.
Consider this 3d scene:
From a side view with camera shown:
You can see that the grid is further away than the cube, the depth sorting seems to be working fine. But say if I move the camera to be below the grid problems start to occur:
The depth sorting routine still thinks the grid is further away and draws the cube on top of the grid! Has anybody got any experience with this? Can anybody give me some tips?