Originally Posted by: Benjamin Nitschke (DeltaEngine) 
Hey PG.
First of all 8k vertices and even having 44k indices (which sounds like a lot for 8k) is no problem on any platfom (neither on the limits side or the performance side).
Cool!
Quote:We do have some mesh atlasing and sharing in the lower levels, but I am not sure if this code is activated right now, some hints could be in OpenTKGeometry.cs. The idea here is that you just assign lots of data to GeometryData or even better use Mesh.Draw, which calls Material.Draw with the geometry and then stuff will be optimized in the best way possible on each platform.
By 'mesh atlasing', you mean it automagically splits up the mesh into submeshes if it deems that a more optimal way to render it? I'll take a look at OpenTKGeometry and see what I can discern, anyway.
Quote:In your case you could just split up the 8k vertices and 44k indices into many meshes (you can share the same data if you like) and just throw them all out, the MaterialManager will sort and put them back together in the fastest render order (since they probably share material, shader and mesh data, they will be rendered in one batch later anyway).
I notice this summary comment in the MaterialManager:
//Show all materials collected this frame with this MaterialManager. Renders out all materials in an optimized way (sorted by render layer, then by blendMode, then by shader (currently disabled, we only have one shader working now: DiffuseMaterial), and finally by material data (image and color).
An additional reason I am splitting up the mesh into submeshes is it is allowing me to draw the meshes in z-buffer order.
I do this in a somewhat crude way: I maintain a bounding box round the submesh as I add vertices to it, and I assign a single z-buffer value to the whole sub-mesh - which I could obtain, for example, by taking the centre of the bounding box, multiplying by the WorldViewProjection matrix and storing the z value resulting. (I don't do it quite that way, I do something a bit more sophisticated but I don't want to needlessly overcomplicate this post!)
Ok, so at the end of this, each sub-mesh has a single z-buffer value which I then sort by to determine rendering order. I find it makes about a 15% improvement in framerate having it sorted to reverse-sorted - and, just as importantly, the framerate stays consistent (not better from one viewpoint and worse from another).
So, going back to the comment in the MaterialManager, it doesn't appear that it offers any z-buffer ordering possibility (or does it?). This would clearly be an ordering that occurred after all the others. My suggestion would be to have a new Property in GeometryData that could be left as zero, or could be populated by the coder in whatever way the coder saw fit, and, if present, would serve as the last ordering the MaterialManager sorts by.
(I am right in thinking that the MaterialManager class is not open source, right?)
Quote:You could also try to do some of your own VertexBuffer and IndexBuffer stuff (all the low level code is open), but we obviously can't guarantee it will run fine on other platforms. But you could try it out and we can help test and optimize it
It's all quite a lot to take in right now. That may be for a later time :)
Edit: (Edited out edit cos I think I answered my own question!)
Edited by user Monday, October 10, 2011 2:59:20 AM(UTC)
| Reason: Not specified