• Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About PaulWendler

  • Rank
  1. Thanks! I have done it the way you suggested.
  2. 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!