Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 PaulWendler   Members   -  Reputation: 104

Like
0Likes
Like

Posted 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!



Sponsor:

#2 EWClay   Members   -  Reputation: 659

Like
0Likes
Like

Posted 07 April 2013 - 07:48 AM

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.

#3 PaulWendler   Members   -  Reputation: 104

Like
0Likes
Like

Posted 09 April 2013 - 01:23 AM

Thanks! I have done it the way you suggested.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS