1

I have a BSP tree for depth sorting in an isometric game (I've tried countless other methods) it's seems to be close, but in my game I cannot split the assets. So, items that intercept the current plane, I simply add them to both the "behind" and "ahead" nodes (as suggested in http://www.seas.upenn.edu/~cis568/presentations/bsp-techniques.pdf).

When I traverse the tree (from lowest depth to highest), I only render the sprite once (the first time I approach it) but this seems to be placing some sprites too low in the display order.

Any insight on this would be greatly appreciated. This is in (mostly) C for iOS, btw.

Thanks in advance (and I try to answer some questions on here, but y'all are so darn fast!).

tomdemuyt
  • 4,572
  • 2
  • 31
  • 60
ICanChange
  • 110
  • 7

1 Answers1

1

I don't think a BSP tree will help you sort out the (literal) sprite sorting issues prevalent in isometric tile rendering. Especially if you have archways like doors, there will always be a point where the character just pops under/above the archway. BSP trees help sort visible areas in a 3D world quickly, but an isometric map is a 2 dimensional, layered view where other effects like size of individual tile images play a larger factor than position in space.

The most common solution is in fact to split the assets in order to render individual parts of an archway (or any larger isometric object) either in front or behind the player, depending on each part's distance to the camera.

The alternative is to add blocking so that the player and other objects can never get too close to areas where sprite rendering normally fails due to sorting issues. But that only works if it is built-in from the start (size of tiles, size of world collisions).

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • Thank you so much for your help, luckily I don't have any items that require an object to pass underneath them. Many of my object take more than 1x1 and I don't have the luxury of splitting them. From what I understand, the real answer is to essentially "compare everything to everything." because there's no absolute equation for the solution (for instance, distance from origin). It seemed like a BSP tree was an efficient way of doing this. Essentially I have a bunch of items with a grid x,y,width,and height and I need to get them into a back-to-front order (painters algorithm).THANKS SO MUCH! – ICanChange Aug 08 '12 at 20:23