Advertisement

Question on Octrees

Started by January 17, 2001 05:46 PM
4 comments, last by Andrew Russell 23 years, 10 months ago
I am wondering. If you were to not split polys and include the same poly in diffrent nodes, what is the best way of stopping it from being drawn twice? I don''t want to go through and mark each one and then loop through them all and unmark them, beccause I am thinking of making some rather large worlds. ANDREW RUSSELL STUDIOS
marking them is the best way.
start at the top node test if its visable
-------
visabilty testing
-------
if (visable)
mark as visable + test its children
else
mark as not visable
-----
drawing
------------
if (visable)
draw and repeat with its children
else
go up a level

no need to unmark everything first




http://members.xoom.com/myBollux
Advertisement
OK, I just got an answer to this on tiberia (with help from merrick (aka morfe) and SHilbert) (if you don''t know what it is, you should see the lounge) it was:

use a frame counter

go throught the octree and see what needs to be drawn, if a poly needs to be drawn, add to a list UNLESS that poly''s frame counter is the same as the main frame counter, then it is not added

draw the list

if the counter is about to overflow, then set it back round to 0.

increase the counter.


there may be some flickering, but not enough to be noticable, unless the user has a shocking frame rate

ANDREW RUSSELL STUDIOS
Oh, and zedzeek, I didn''t see your reply before I replied, but it has nothing to do with what I ment (I was talking about polys)

ANDREW RUSSELL STUDIOS
Woh...confused. Okay, lets say I am using a Vertex Buffer and an Index Buffer. I need to create a list anyway so I can probably use those. What is all this about a frame counter or what ever? I am a little confused as to how that works. Could you fill me in a bit as to how this check works and if I can use the Vertex Buffer or Index Buffer to lessen the memory needed? I just have no clue what you mean and how you mean it....thanks
For each vertex or triangle have an integer. In that integer you store the current frame number(ie, frame 0, 1, 2, etc... gets really high at 60 frames/sec, but that''s ok). Then you don''t have to clear all of the flags after drawing your meshes because at the end you increment your frame counter by one and now none of the vertices/triangles have that number(the ones you just drew would have current_frame - 1). So when you are drawing the new frame just chech to see if a triangle has already been drawn this frame by checking it''s frame number. If it hasn''t been drawn yet(it''s frame number is less than the current frame), draw it and set it''s frame number to the current frame. I hope this helps.

This topic is closed to new replies.

Advertisement