   Software Renderer, perspective projection, which coord system for BSP tree sorting
I am writing an SVG exporter for some 3D scene. Since SVG does not have any depth buffer or the like, the primitives are sorted within a BSP tree for back -> front ordered rendering. The tree is dynamically created on every 'frame'. Somehow, I cannot get the correct sorting order to work. The problem seems to lay in the mess I made with coord systems and plane equations. The BSP tree is created from primitives in camera coords. I did choose camera coords, because I was hoping for an efficient traversal through the tree: since the camera is the origin, the front /back side for every BSP plane node is easily determined by the sign of the Z coordinate of the planes normal.  The problem: the above is working for orthographic projection only. In order to make it work for perspective projection as well, the sorting would have to be done in ND coordinates. Otherwise, the perspective distortion is not included and some primitives may get false identified as front/back. Is this assumption right? Or are there any more efficient ways to get the correct back -> front order? I wonder, because I read that BSP trees are often precomputed in advance for static geometry and reused for arbitrary camera positions. If the sorting would have to be done in ND coordinates, this would involve a normal transformation from the BSP coord system to ND coordinates for every node in the tree? How are perspective projections commonly handled in BSP trees ? Which coord system is used for storing plane equations in the tree? Thanks for any comments!
  Normally you would classify a point such as the camera position as in front of or behind a plane using the plane equation, which will give a distance which is either positive or negative. This is independent of the coordinate system so you need build the BSP tree only once.Don't worry about the efficiency of the test; it is just a dot product and very quick compared to the cost of actually traversing the data.   ;Thanks! I have done it the way you suggested.