Skip to main content
gamedev.net
🔒 Locked

Octrees how to.... ???

Started by ogracian May 30, 2002 at 8:59 PM 2 replies 950+ views
Original Post
ogracian
ogracian
Hello I am trying to implement a "simple" 3D engine. Currently i am using regular octrees (eight child of equal sizes)but I just pass to the renderer all the polys of nodes which intersect and inside the view frustum so my questions is as follows: ¿Is possible to use the Octree to render the polygons in a Front-To-Back order? By other hand I am trying to implement a code to order the polys inside Octree SECTORS to render only the which are facing to the camera, so maybe someone have tested it. My method is as follows: Build a regular Octree to partition the World in sectors of equal sizes. Then once the Octree is completed, I loop through all Octree SECTORS (nodes), and build a SOLID BSP tree for each sector that contain polys. Then to render it I use octree to perform SECTOR - VIEW FRUSTUM test and when I need render my SECTOR I loop through the BSP stored in that sector to render only those polys which are facing the camera. But to get this method rendered in a correct Front-to-back order I need traverse the Octree in FRONT-2-BACK order. Please tell me if someone have tryied to implement somthing like this? I really apprefciate any help about this, thx.
AndersO
AndersO
http://www.flipcode.com/harmless/issue02.htm


Bad Monkey
Bad Monkey
Just a thought, but given the viewer/camera position, you could simply traverse each node in order of the distance from the viewer (i.e. distance between viewer pos and node centre, and using distance squared of course for greater speed). So for front-to-back render, just visit nodes in order smallest distance to largest distance (or do the opposite for a back-to-front render, useful for rendering translucent/blended surfaces). This should work fine as far as I can tell.

Hope that helped

[edit] AndersO posted while I was writing... the method shown on Harmless Algorithms looks much quicker, so disregard my drivel and use that

[edited by - Bad Monkey on May 31, 2002 3:14:24 AM]
ogracian
ogracian
Thank you both for your replays. I guess i will try the Bad Monkey methodd, which seems easy to implement : )

Thanks for your help.

Regards!
Oscar

Topic Locked

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

Sign in to reply to this topic.