SoC2006 Instancing         Instancing, Crowd Rendering - GSoC 2006

Summer of Code 2006: Instancing, Crowd Rendering

Student: Jean-Baptiste Griffo (Crashy)

Mentor: Paul Cheyrou-lagreze (tuan kuranes)

Status: Incorporated into Eihort (OGRE 1.4)

Objective

Provide techniques to render numerous objects at the lower performace hit, in cases where Static Geometry is not as powerfull as geometry Instancing.
The project is divided in three main parts:

  1. Implementation of Instancing for static renderables using shaders.
  2. Implementation of Instancing for animated renderables using shaders.
  3. Provide documentation and samples to help final user to choose the best technique.



Steps

Until the 25 june. 99%done

1. make a stable code for the shader instancing of static objects, compatible with every .mesh file.(99% done)

2. provide some access methods to place objects, rotate them, scale them, etc.(100% done)

Globally, those methods are doing the same things as the sceneNodes methods. As there will be only one node for many instancied objects, the scene node methods will be useless in our case. That's why it is necessary to provide such methods at a renderable level.
Those access methods will modify only the transformation matrix, sent to te vertex shader as custom parameter, of the choosen instance.

3. Release of a little demo of fully implemented Shader Instancing for static objects. 99%done

From ~1 july to ~1 August:

Implementation of crowds: 100% done

4. Hardware skinning (So a shader for instancing AND hardware skinning) 100% done.

5. Independant Animation control for each instance 100% done

The idea is to pick one animated instancied object in the batch, and to handle it as if it was a single entity, using animation states to manage animations.

6. Add more independant information for each instance of the object(name, ID, animation data)

From ~1 August to the end:

7. Addition of shadow caster and receiver vertex program 50% done(shadow caster are done)

8. Debug

9. Redaction of the docs

Implementation details

ClassDiagram3.png

The whole idea is to first create a Render Operation containing n copy of the object, and use this render operation multiple times with different custom shader parameter

Here is how it works:
-add n times an entity to your Instanced Geometry.
-Call a build() method that will batch the n into one vertex/index buffer, adding an index to the vertex data, to identity each instance of the object that is in the batch.
The build() method will create a Region(aka Batch Instance). The region will have multiple LOD Buckets, each lod Bucket multiple Material Bucket, and in each material bucket, multiple geometryBucket(or a BatchedGeometry) will be created. Usually, there is only one geometry bucket in the material bucket, but if the total vertex count is > 65535, another geometry bucket will be created.

-Create new BatchInstance with the addBatchInstance() method, that will clone all the LOD, material, geometry bucket of the first BatchInstance. The new geometry buckets are using the same render operation as the one of the firste BatchInstance.

The batchInstance has n InstanciedObject, and an array of n transformations, used as a custom parameter for the instancing Vertex Program.

Modifying the istanciedObject's transformation will alter the array of the batchInstance, and update the custom parameter for the VP.


Alias: SoC2006_Instancing