Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to geometry instancing

Similar presentations


Presentation on theme: "Introduction to geometry instancing"— Presentation transcript:

1 Introduction to geometry instancing

2 Instancing Introduction to geometry instancing

3 Instancing Explore the DirectX SDK Instancing sample

4 Geometry Instancing Games often have to render many objects of a similar type (perhaps differing only in terms of colour, position, orientation, etc.). Rendering a large number of objects (each with a limited number of polygons) can stretch modern GPUs, which are not designed to render a small number of polygons thousands of times per frame (the pre-call setups costs very quickly accumulate).

5 Geometry Instancing Submitting triangles to the GPU for rendering is a relatively slow operation. On modern hardware about 30k-120k batches per second is readily attainable. This amounts to 1k-4k batches per frame at 30fps. Instancing attempts to minimize the number of draw calls, alongside state changes, and render the same triangles multiple times within the same batch in a single call.

6 Geometry Instancing Instancing requires the vertex and index data to be organised in a particular way so that multiple copies of the mesh can be drawn per batch. Instancing is best suited to tasks where the model to be instanced is relatively simple (<1000 triangles). For a complex model, instancing will return little, if any, benefit, as the performance bottleneck will become GPU bound.

7 Geometry Instancing (Hardware instancing)
Hardware instancing sends two vertex streams to the GPU. One stream contains the normal vertex data and a second stream holds instance data (position, colour, etc.). The advantage of hardware instancing is that the original mesh need only be sent once to the GPU (saving memory).

8 Geometry Instancing (Shader instancing)
Shader instancing builds a vertex buffer which holds a number of copies of the original mesh. The buffer is then used to draw batches of the original object. Instance data is set within the shader using constants. The number of objects drawn per batch is constrained by the maximum number that can be stored within the vertex buffer and the number of available shader constants (e.g for SM2.0)

9 Explore the DirectX SDK DX10 Instancing sample

10 Directed Reading Directed reading concerning geometry instancing

11 Directed reading Directed reading: Read Batch, Batch, Batch: What Does it Really Mean – for information on the importance of batching within games Read GPU Gems 2 – Inside Geometry Instancing for more information on instancing Read GPU Gems 3 - Animated Crowd Rendering for more information on advanced instancing

12 To do: Summary Read the directed reading
Today we explored: Different geometry instancing techniques To do: Read the directed reading Think if you would like to consider instancing within your project


Download ppt "Introduction to geometry instancing"

Similar presentations


Ads by Google