PDA

View Full Version : Optimizations, Octrees and other things ;)



KILE
06-12-2002, 01:56 AM
I'm implementing an octree based engine and the lastest days I code a q3bsp loader, but I copy the level geometrư into my own level data format (Not using the bsp structure). Without using the octree, simply rendering all the data using glDrawElements I take about 35fps on TNT2 Duron1000. But when I make the octree the framerate down to 20~fps :_(. Basically I store in the octree leafs the geometry that are in each cube. Then, when I have make all the octree, I create an DisplayList for each leaf node. (Into the display list I call glDrawElements also). So when I render the octree I make glCallList() of the visibles nodes. I think that this slow framerate is due to that at first time I have only a few number of meshes and I make less texture changes to render its, but then, using the octree, I have more objects (DisplayLists) and as I don't sort by texture, I make more texture changed.
Any idea if I'm in correct?

Another idea that I have about rendering octree is to have a list of faces array for each texture for example: KFace *FacesByMaterial[MAX_MATERIALS] and KVertex *ListOfVertex;
Then when I finish to create my octree, I don't make the display lists for each node. I only wait that call RenderOctree() and I find the visibles nodes and copy their geometry to this faceList, so at the end of the search we have FaceByMaterial fill with the face ID that are currently viewed. And we only must to do:
For NumMaterials
UseMaterial(i)
glDrawElements(FaceByMaterials(i))
but I don't know y make this one in each frame is too expensive. I tried the both method but I don't note to much perfomance difference :_(

And finally I want to ask you another thing, If I have an scene with 5 movable objets that have the same material. Firstly you can do:
for (NumObjects)
UpdateMatrix(i)
glDrawElement(Object(i))
to make the transformation T&L. But how much perfomance increased if you make the transformations by software (Using 3DNow aceleration for example) and then copy all the transformed vertices to a commom buffer to all the same textured objtecs and then make:
for (NumMaterials)
UpdateMaterial(i);
glDrawElements(ObjetsbyMaterial[i]);
http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks to all