Skip to main content
gamedev.net
🔒 Locked

octree and data structures

Started by t_harry 2 replies 600+ views
Original Post
t_harry
t_harry
hi all i'' ve coded some classes to use milkshape 3d(both static and animatef) models in my projects, and i'' d like to use one large ms3d file as my "world map", becouse i don''t want bsp trees(rather open terrain) i decided to use octree(subdividing space into 8, and 8, and 8 pieces...) - but my code for ms3d keeps data top-down, i mean i''ve got grups of triangles(grouped by material), then triangles(indices to vertices and so on - like RSN but not exactly the same) so the question is how to use octrees?(i ve seen a tutorial, but in it the triangles are beeing stored in vectors in leafs of the tree, i can'' t do that - i dont want to enlarge my data(to every triangle keep its material state), i wish to keep state changes of material as low as possible - but on the other side, checking every frame every triangle is it to draw(i mean is the part of the space that he belongs to draw) is a pain... how to get it into one piece smart and well? thanks for answering and sorry for my english
v71
v71
For each node you store an index pointing to the triangle that is spanning or entirely in the node, when you need to render ,you have to check if your triangle ha already been drawn because ,unless you want to split each triangle spanning more nodes, many triangle will belong to different nodes, once you have a ''final'' list of indices ( spelling ?? ) of your triangles is time to sort them by state , that''s to say you have to group triangles that shares the same textures and the same rendering attributes ( think about blending or multitexturing ) .
In my engine everything work in this way, time ago i''ve read a Yann reply saying he doensn''t check for multiple rendere surfaces but i think he splits triangle as well , this could be and advanteg , but increase a lot the data for the ''level''
i hope it helps
jamessharpe
jamessharpe
quote:
Original post by v71
In my engine everything work in this way, time ago i''ve read a Yann reply saying he doensn''t check for multiple rendere surfaces but i think he splits triangle as well , this could be and advanteg , but increase a lot the data for the ''level''



Yann''s engine doesn''t primarily use octrees as the data structure so this is not an issue. He doesn''t split triangles that often in the system he uses - it''s adaptive and so the nodes of the trees can overlap a certain percentage to accomodate the polygons that span two nodes. There are plenty of threads outlining Yann''s technique so if you''re interested check out the FAQ for a list of threads.

James
de_matt
de_matt
Correct me if I''m wrong but if your making worlds based on a single plane (an xz plane) and not making planets like in Populous you could just use a quadtree. It''d probably be easier to do and render faster (i''m not sure about the last bit)

Topic Locked

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

Sign in to reply to this topic.