In preparation for the graphics work I’ll be focusing on over the next month or two, I’m trying to speed up the VectorStorm library’s rendering path as much as possible.  There are a few new things in the library today (visible on its GitHub repository, in a branch called “feature/vbobatch”)

  • First up, as you’d probably guess, batching of VBO drawing.  Now not only does VectorStorm try to render everything using each material together, within each material, it tries to draw everything that’s using a particular set of vertices together, to save on time spent setting and unsetting which vertices to use.  For example, all the trees in the Milestone 2 build use the same set of vertices, and so that set of vertices only has to be set once, and then trees get drawn in all sorts of different places.  The screenshot here is of a region which is packed with 1000 trees (MS2 has only 100 trees), still holding 30fps in a non-optimised debug build.

(From the ground, a thousand trees looks like this second screenshot.  The apparently improved performance bar visible in the screenshot, compared against the first screenshot, was just a glitch at the moment I took the screenshot;  most frames looked like the timing bars from the first screenshot, using almost 33 milliseconds to draw the trees in the view)

  • Another big win (actually, bigger), was switching VBOs to use packed byte colors, instead of floating point colors.  Basically, this trades some color fidelity for a 75% memory saving on color data.  This really made no visible difference in the final rendered images, and it did make a noticeable improvement to rendering performance, especially in this “thousand trees” stress-test.

These changes are in the public VectorStorm repository right now, though I haven’t tested them enough to promote them into trunk yet.  That’ll be in another day or two, probably.