Shader instancing uses a vertex shader to draw up to 60 instances of an object at once, each with its own transform. In simpler terms, it lets you draw up to 60 copies of an object, each with it's own position, scale, and rotation that can continuously change. This is similar to Lonesome Ducky's mesh comibner, with the following differences:
- Shader instancing renders several copies of a single mesh at once. It cannot render multiple meshes. However,
- Individual instances in a groups of objects using shader instancing can move, rotate, and scale independantly of each other, making them ideal for large groups of moving objects.
My code uses empty scene nodes to store the transforms, so adding an instance returns a pointer to a scene node. This lets you treat each instance like any other scene node, letting you apply animators, set position, etc. It works well on even low level hardware as long as it supports Shader Model 2.0 (the screenshots you see above were taken on a laptop with integrated graphics).
I'm finishing up the code and trying to figure out a few remaining issues. One of them is related the material type - since this uses a shader do its magic, any custom material types also have to use the instancing code in their shader.