Archived

This topic is now archived and is closed to further replies.

Octree question

This topic is 5398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites