Instance

Screen Shot 2014-06-23 at 4.36.10 pmI’m currently working on the next RenderTech build of MMORPG Tycoon 2, which will finally be using OpenGL 3.

The big feature which made me finally switch to OpenGL 3 is its guaranteed support for instance rendering, in which you can draw lots of copies of a model using a single draw call, instead of needing a separate draw call for each copy of the model.

In the screenshot to the left, you see a field of 10,000 white boxes hovering over the MMORPG Tycoon 2 world (at an altitude of about 1.5km).  These boxes are being drawn using a single draw call, and so drawing all 10,000 boxes isn’t making any noticeable difference to performance at all.  If I draw each of those boxes independently, though, the overhead of 10,000 draw calls drops performance through the floor.

This sort of rendering technique is absolutely essential for aerial views of MMORPG Tycoon 2’s forests, and other broad terrain features.  From the height of the camera in this shot, I could theoretically have tens of thousands of trees visible.  With instanced rendering, I can actually afford to draw them all.

Instancing isn’t fully integrated into VectorStorm yet;  I’ve added it to the vsDisplayList’s low-level rendering commands, but it’s not properly exposed to games yet (which is why the test above is using simple cubes, rather than MMORPG Tycoon 2’s tree models).  My task for tomorrow will be setting up a nice interface to the functionality, and then (if I’m lucky), getting trees to draw using it.

Which would theoretically mean that I could re-enable full forests, which slowed things down to a crawl in the MS4 build.  With any luck, screenshot of that, tomorrow.  :)