Hi Jimmy,
What will be a good-sized chunks? The bigger the better?
You need to experiment on the video cards you will be using, but in general, as I said before in this thread, thousands per vertex array (perhaps tens of thousands).
My scene are contains numbers of models which consist of multiple parts. Although each part will always be in the same position relative to each others, I can't really merge them to one osg::Geometry. Because they need to be able to change colour independently on run time.
If your colors are being specified per vertex, then you can change the colors of a certain set of vertices without affecting the others. Or, you can have multiple geometry objects sharing the same vertex array but having distinct color arrays, as I see you've thought of below. It's not the same since OSG will still have to switch arrays for colors, but it will be less work than what you're doing now.
Or just set the colors using textures and swap the textures when you need to change colors.
It's more work for you to code it up, but if you're hitting bottlenecks then it's probably more important to you that you improve the frame rate, so getting your data into a format that OSG, OpenGL and your video card can process more easily will pay off.
Now I am thinking about to create one huge static vertices array which will be used by all the geometry in the scene with correct indexing. Do you think this approach will help? or it might make the matter worse?
It will differ from card to card, but generally one huge array is not the answer, it's more about grouping so there are 10 or 20 thousand vertices per array. You need to experiment with the granularity. You could easily make a test program where you would make a vertex array of some large number N of vertices, then two of N/2 each, then four of N/4 each and so on to experiment. Make the test reasonably close to your actual situation, but set it up so that granularity is parameterized (number of vertices per array, number of geometries per group, number of transforms above the groups, etc.)
The osgUtil::Optimizer has visitors that can help you do some of the necessary operations automatically, or can show you working code to do it which you can then copy and modify. For example, the FLATTEN_STATIC_TRANSFORMS setting will remove static transform nodes, the MERGE_GEODES setting will put several geometry objects under a single geode instead of multiple geodes, and the MERGE_GEOMETRY setting will merge several geometry objects into a single one (merging arrays together). See "osgconv --help-env" for more settings, and the osgUtil::Optimizer header for pointers into the classes that do the work.
Geez, I'm feel like I'm writing a novel here. I'll see if I can put this up on the wiki so I don't have to type all this up again in the future. :-)
Hope this helps, J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

