1

This is more of a conceptual question than a coding question. I have figured out the basic concepts of a BSP tree but am having trouble wrapping my head around the positioning. I have figured out that to find my current location in the BSP tree, I keep recursively iterating through the tree moving to the right if I am in front of the split plane, and left if I am behind it. When I eventually hit a leaf node, that is where I am in the world.

Now, in terms of rendering, if I had to render from front to back, would I start at the right side of the tree and render all the way recursively until I hit the last node on the left side. What about back to front? Would it be the opposite?

Thanks!

1 Answer 1

1

If you wanted to draw back to front which is the Painters algorithm you'd traverse left nodes first when you are in front, then render and then traverse right nodes.

For front to back it would be the opposite.

2
  • Your wording has confused me a bit. So with Painters algorithm, I am traversing from the left until I get to my current location, then render that and then traverse right and render that as well? Feb 7, 2012 at 23:57
  • Yes basically that is how it works. It's a depth first traversal going left first painting on the way up befote traversing right. So at each node you do this: determine whether you are in front or back, then you would traverse further left or right resp. then paint then traverse right or left resp.
    – stryba
    Feb 8, 2012 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.