Skip to main content
gamedev.net
🔒 Locked

Octree Question

Started by RedKnite Aug 21, 2000 at 3:05 PM 1 replies 350+ views
Original Post
RedKnite
RedKnite
I need help getting rid of overdrawn polygons in my octree code. The code to build the tree works fine, but when it comes to polygons that are divided between 2 nodes, i either have to split them(too slow) or add them to both node lists, but once the tree is build, how can i get rid of these repeat polygons? because even a simple list of 300 polygons jumps up to 736 the way it is. Any ideas? thanks ~ Chris
Andrea
Andrea
The same polygon can be stored in more than one octree node.
In theory you can use a BOOL flag for every polygon. If you render a polygon you can set its flag to TRUE...when you encounter this polygon again you ignore it because the 'rendered flag' is TRUE.

The problem is that you have to reset to FALSE the flag for every polygon and for every frame.
A solution is to use a DWORD counter that represents current frame. If you have to set the polygon as rendered simply set this counter to the current frame...if you encounter a polygon with an index less than current frame it was not rendered otherwise you have not considered it yet.
In this way you have no need to reset the flags because every polygon will have an index less than next frame index.

Edited by - Andrea on August 21, 2000 5:10:22 PM
IpSeDiXiT
maikgerth
maikgerth
nice idea andrea ... thanks =)

Topic Locked

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

Sign in to reply to this topic.