Page 1 of 6 1234 ... LastLast
Results 1 to 40 of 217

Thread: BSP trees [Resolved, now also with Quad, Oct, AABB, K-D, BV, OBB, BR, ABT, BS trees]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    BSP trees [Resolved, now also with Quad, Oct, AABB, K-D, BV, OBB, BR, ABT, BS trees]

    Anyone got any links to some articles/tutorails about BSP trees? I am thinking about using quad trees or oct trees for for my outdoor terrain engine in DX9. But I wan't to explore the possibilities before I head away with the coding.

    Anyone?
    Last edited by NoteMe; Apr 4th, 2004 at 07:56 AM.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I used to have but seems like the links aren't working. anyways I can instruct you how to make a BSP tree
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    What does BSP stand for..BTW...Binary Seach P????


    Yeah if you could do that, it will at least be a start, and maybe I even understand how to implement it to use it in my terrain engine, to calculate the view frustum...

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Binary Space Partitioning. If you know what a binary tree is then you're half the way there already. a BSP tree is a binary tree which splits up all objects in partitions, by dividing the space in two for each node. A quad tree does this in two dimension while an oct tree does it in three
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    ok this is probably the most ugliest pic i've ever drawn, but you get the idea
    Attached Images Attached Images  
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I know what a quad tree and a oct tree is....but don't know what a BSP tree is,...can you show me a picture of an BSP tree in action...


    Here is my quad tree in action...

    Attached Images Attached Images  

  7. #7

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Forget about me asking about a picture, I can see you have posted something now...not sure what it is but give me some time to dechiffer it...

  8. #8

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    ok this is probably the most ugliest pic i've ever drawn, but you get the idea
    Hehe...ok, I got the idea..even if it took more time to dechiffer the drawing then it took to understand the idea..

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    hehe.. i told you it was ugly
    anyways I found a link here for you anyway, which is quite good i think
    http://cs.smith.edu/~mcharley/bsp/
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Wow...thanks...thats much better then all the links I have found...thanks again..

  11. #11
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  12. #12

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by cyborg
    You might find something here:
    http://www.gametutorials.com/Tutoria...OpenGL_Pg5.htm
    Thanks I knew about that. But I don't find the BSP tutorials very general. They are to stuck on the Quake format and OGL, I wanted it more in general. Like the Oct Tree tutorial they have there. The link Keda gave me was actually pretty good.

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    hehe always better in the more general form
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  14. #14

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Not always, but first og all I am using DX second of all this as more or less nothing to do with the graphics API you are using....so it was the theory I was looking for. That was why I wrote Articel/Tutorial, and not just tutorial...

  15. #15
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    first og all
    when i saw this first i thought you were writing norwegian

    its always better with theory first, then implementation think of how much work can be saved if people did this instead of writing tutorial for every language and api etc
    Articel/Tutorial
    yeah well that doesn't say much, but you could trust me to find one that is theoretical
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  16. #16
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    Originally posted by kedaman
    when i saw this first i thought you were writing norwegian
    Me too!
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  17. #17

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by cyborg
    Me too!
    Me too...


    Yeah Keda...you are right (at least a little bit), but then you have to write one for the theory, and one for all the APIs, thats one more then not writing theory at all..

  18. #18
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    No note, you just refer to the theory page from the implementation page and if you leave out the theory completely you have only one way of doing things, without understanding how and why it works
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  19. #19

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Hehe....don't start to irritate me again...I don't have the time today to argue with you...


    I see your point....But I won't admitt that I am wrong......I never will...

    I must admitt that most often when I deal with an advanced topics for the first time like when I started to learn Vertex Shaders, Pixel Shaders...then I didn't understand much of the theory before I jumped into the coding...but it was nice to refer back to later when I understood what the theory was all about...

  20. #20
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Originally posted by NoteMe
    Hehe....don't start to irritate me again...I don't have the time today to argue with you...

    gheeheheehe why else would I be posting here
    I must admitt that most often when I deal with an advanced topics for the first time like when I started to learn Vertex Shaders, Pixel Shaders...then I didn't understand much of the theory before I jumped into the coding...but it was nice to refer back to later when I understood what the theory was all about...
    Yeah, part of learning theory must be seeing what its for, otherwise its nonsense metaphysics So its no use to learn any theory if you don't set out and do something with it as well
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  21. #21

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    gheeheheehe why else would I be posting here
    To teach others..and ask questions..

    Originally posted by kedaman

    Yeah, part of learning theory must be seeing what its for, otherwise its nonsense metaphysics So its no use to learn any theory if you don't set out and do something with it as well
    I often learn things in theory and find out that I don't need to try it in practice at all..like the BSP tree..I don't need that for my out door terain engine....an extended quad three will do the job....


    But I will try it for an indoor envirment once I have time....probably 10 years from now..

  22. #22
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Originally posted by NoteMe
    To teach others..and ask questions..



    I often learn things in theory and find out that I don't need to try it in practice at all..like the BSP tree..I don't need that for my out door terain engine....an extended quad three will do the job....


    But I will try it for an indoor envirment once I have time....probably 10 years from now..
    but a quad tree is a BSP tree
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  23. #23

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Hmmm...not the way I am using it....I am bending all rules here......trying out some teories....


    But do you mean it...I can't see that it is the same thing here...

    so is oct tree a BSP tree too then?

  24. #24
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    yeah, thats what it does, binary space partititioning, oct and quad are just the amount of dimensions log2-ed
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  25. #25
    Lively Member
    Join Date
    Oct 2003
    Posts
    127
    Are BSP's effective at drawing a top down perspective, or just a FPS?

  26. #26

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    yeah, thats what it does, binary space partititioning, oct and quad are just the amount of dimensions log2-ed

    Heheh,.,..Then I didn't understand the theory at the page you showed me.......and wy did theis guy ask what games used oct trees and what games used BSP trees in this thread if it is the same....????


    http://www.beyond3d.com/forum/viewtopic.php?t=11084

  27. #27

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by bobthebobert
    Are BSP's effective at drawing a top down perspective, or just a FPS?
    Just FPS or when you can see more then just top down...then you don't have to draw everything behind you and things like that....at least I can't see the big advantage of using it in a top down game....

  28. #28
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Originally posted by NoteMe
    Heheh,.,..Then I didn't understand the theory at the page you showed me.......and wy did theis guy ask what games used oct trees and what games used BSP trees in this thread if it is the same....????


    http://www.beyond3d.com/forum/viewtopic.php?t=11084
    no idea.. perhaps he was talking about BSP trees in general since oct trees are just a special case
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  29. #29
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Originally posted by bobthebobert
    Are BSP's effective at drawing a top down perspective, or just a FPS?
    yeah sure, in a strategy game you would benefit too having units starting attack the enemy if they come close for instance.. and generally you would need to do collision detection anyway. Just use a quad tree.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  30. #30

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    yeah sure, in a strategy game you would benefit too having units starting attack the enemy if they come close for instance.. and generally you would need to do collision detection anyway. Just use a quad tree.

    I can't see the point....if you have a top down game, you know all the coordinates, and you can only do ONE boundingBox check to see what is going to be drawn, the same with when they are going to start to attack. Fussy Logic is great for simple, "When does the enemy attack AI"....

  31. #31
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    its not about knowing the coordinates, its about reducing search time, and trees are good for just that. If you have one bounding box, then search time is n, if you have a tree, search time is logn
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  32. #32

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    What the hell did I think of when I wrote those last two posts.....I also think it can be usefull in a 2D game, maybe even a solling 2D game.

    But quad and oct trees are not that fast in a very dynamic environment. Then they use to much time to update a tree...I have heard that Sphere trees can be faster for that...

  33. #33

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    BTW, in one of the Gems in Game Programing Gems 2 there is a section about Compressed AABB, and a quote from the first section goes like this:

    This section covers quadtrees, k-d trees, BSP trees, bounding volume trees, and axis-aligned bounding boxes...

    So I guess it is not the same anyway....let me draw you a picture Keda...

  34. #34

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    If you look at this, I am not sure if I got the BSP tree right, but for me it looks like the BSP tree always devide the part of the map in two. First you have the whole map, then devide it in two (hence the size of my nodes..) then devide those two parts in two, and so on...

    In a quad tree you devide the the whole map (root) in four, then you devide those parts in 4 again...and so on...

    So it is not the same tree.


    If you look at my drawing, you will see the two trees the way I think they are...(I know my quad tree is right), and if you look at the first drawing I made you see the whole map and how it is devided into the other levels in the tree...

    Attached Images Attached Images  

  35. #35
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    technically its not the same tree no (i never said that ), but theoretically a quad tree classes as a BSP tree, basically the only thing you have more in quad trees is that two levels are unified in one, so each node consists of 3 bsp nodes.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  36. #36
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    here's a diagram, the yellow represents the theoretical binary tree, and the quad tree
    Attached Images Attached Images  
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  37. #37

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    You like to admitt that you where wrong just as much as me...don't you...

    A BSP tree has a left and right (Java/C/C++)pointer, but a quad tree has a A, B, C, and D (Java/C/C++)pointer to the next nodes.

    A mother leaf in a BSP tree has 2 child leafs, a mother leaf in a quad tree has 4 child leafs...thats the way it is...


    are we going to discuss

    - k-d trees
    - bounding volume trees
    - AABB trees

    now???..:

  38. #38
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    no way i'm going to admit i'm wrong, when i'm not

    yeah go ahead and discuss those because i have no idea what they are
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  39. #39

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    here's a diagram, the yellow represents the theoretical binary tree, and the quad tree

    HEhe....didn't think of it like this before......you are some kind of smart I gues.......but if this is the case, then I can't see the advantage of BSP trees over Quad threes, they have to go through more levels in a BSP tree.

    They have more tests in a QUAD tree, but the smart instruction set in a x86 prosessor has some nice way to make these tests really really fast...

  40. #40

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    no way i'm going to admit i'm wrong, when i'm not

    yeah go ahead and discuss those because i have no idea what they are

    Not me either....but I found this discussion the most intresting since the Arie (Hue/Saturation) thread...so I am nearly intrested in reading about them right now...I have that Gem from my book.......I just wish that I didn't have this ****ing hang over...

Page 1 of 6 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width