Skip to main content
gamedev.net
🔒 Locked

Octree question

Started by Noobster 2 replies 650+ views
Original Post
Noobster
Noobster
Ok, i''ve never programmed any 3D before, but i''ve spent the last little while reading tutorials and going over other peoples Octree code, so i think i''m ready to start coding and i was just wondering if you think i''m on the right track before i get started and waste a bunch of time. So at this point all i''m looking to accomplish is creating my octree (gotta crawl before you can run) and this is *basically* how its works as i can understand it. 1. Read in Height map 2. Find the smallest cube that the whole world/scene fits in and store the center vertex and the width of the cube 3. If the # of triangles inside the cube is greater than some limit (say 64) divide the cube into 8 cubes and test the # of triangles again. Repeat this until the # of triangles is <= the limit OR until the max level of subdivision is reached (don''t really know what that number should be yet). 4. When a cube doesnt need to be (or cant be) subdivided anymore store the triangle info in that node of the octree wow, now that i''ve typed that out, it all seems so simple. Anyone see any major flaws in this? Thanks for the input.
JuNC
JuNC
That sounds about right.

And you are right, the underlying concepts are not particularly difficult, what might be harder is coming up with an efficient (in memory and speed) implementation. Although to begin with, do not concern yourself with efficiency, that will come if you keep an open mind.
skillfreak
skillfreak
in a height map say 1024x1024

if you divide that in half you get 512;
for all the verts that lie on that division, what box do you place them in. obviosly not all four. ( thinking quadtrees )

3x3
-----
|xxx|
|xxx|
|xxx|
-----

3x3 - division lines
-----
|x|x|
|-|-|
|x|x|
-----
( x's are on division lines ( not shown ) )

3x3 - where do the points show go?
-----
| x |
|xxx|
| x |
-----
thx
andy

[edited by - skillfreak on March 6, 2003 9:41:17 AM]
coelurus
coelurus
You split up polygons, not really the vertices. Either, you got a huge vertex pool where all polygons point to, or you copy all vertices used by a node into that node.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.