Jump to content

  • Log In with Google      Sign In   
  • Create Account


PaulWendler

Member Since 03 Apr 2013
Offline Last Active Apr 09 2013 01:22 AM

Topics I've Started

Software Renderer, perspective projection, which coord system for BSP tree sorting

03 April 2013 - 03:02 AM

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!


PARTNERS