Sign in to follow this  
MoOm

Efficient way to render an octree

Recommended Posts

MoOm    122
I'm coding a 3D engine based on octree. For now, to render an octree, I just traverse each node, I determine whether it's visible or not, and then, I draw it. But this is not very efficient. So, I thought to store a vertex buffer in the root node, for each texture, which contains all the vertices of the same texture. In my node, I just store vertex indices. To render it, when a node is visible, I 'memcpy' vertex indices of the node into a larger 'index buffer'. Once all the nodes have been traversed, I render the octree using the new index buffer, for each texture (calling glDrawElements). But this is not yet very efficient :( It is because I use memcpy? or because, when I call glDrawElements, there are vertices in the vertex buffer which don't need to be here (invisible vertices)? How do you render efficiently your octrees?

Share this post


Link to post
Share on other sites
python_regious    929
One method is to use a render queue. When you find a visible node, add it to a list of things to render. The render queue is then sorted, based on shader/render states and so forth, and flushed. I've found it to be quite an efficient method...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this