GPU Instancing
https://docs.unity3d.com/Manual/GPUInstancing.html
GPU instancing
GPU instancing is a draw call optimization method that renders multiple copies of a mesh with the same material in a single draw call. Each copy of the mesh is called an instance. This is useful for drawing things that appear multiple times in a scene, for example, trees or bushes.
GPU instancing renders identical meshes in the same draw call. To add variation and reduce the appearance of repetition, each instance can have different properties, such as Color or Scale. Draw calls that render multiple instances appear in the Frame Debugger as Draw Mesh (instanced).
Requirements and compatibility
This section includes information about the platform, render pipeline, and SRP Batcher compatibility of GPU instancing.
Platform compatibility
GPU instancing is available on every platform except WebGL 1.0.
Render pipeline compatibility
Feature | Built-in Render Pipeline | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom Scriptable Render Pipeline (SRP) |
---|---|---|---|---|
GPU instancing | Yes | Yes (1) | Yes (1) | Yes (1) |
Notes:
- Only if the shader isn’t compatible with the SRP Batcher.
SRP Batcher
GPU instancing isn’t compatible with the SRP Batcher. The SRP Batcher takes priority over GPU instancing. If a GameObject is compatible with the SRP Batcher, Unity uses the SRP Batcher to render it, not GPU instancing. For more information about optimization method priority, see Optimization priority.
If your project uses the SRP Batcher and you want to use GPU instancing for a GameObject, you can do one of the following:
- Use Graphics.DrawMeshInstanced. This API bypasses the use of GameObjects and uses the specified parameters to directly draw a mesh on screen.
- Manually remove SRP Batcher compatibility. For information on how to do this, see Intentionally removing compatibility.
Using GPU instancing
Unity uses GPU instancing for GameObjects that share the same mesh and material. To instance a mesh and material:
- The material’s shader must support GPU instancing. Unity’s Standard Shader supports GPU instancing, as do all surface shaders. To add GPU instancing support to any other shader, see [Creating shaders that support GPU instancing(gpu-instancing-shader).
- The mesh must be from one of the following sources:
- A MeshRenderer component or a Graphics.DrawMesh call. Unity adds meshes from these sources to a list and attempts to instance them together. If the GameObject that a MeshRenderer component is attached to is SRP Batcher compatible, then Unity can’t instance that mesh. For more information, see SRP Batcher compatibility.
Note: Unity doesn’t support GPU instancing for SkinnedMeshRenderers. - A Graphics.DrawMeshInstanced or Graphics.DrawMeshInstancedIndirect call. These methods instance the same mesh in multiple places using the same shader. Unity executes each call separately which means it can’t instance meshes from different calls together.
- A MeshRenderer component or a Graphics.DrawMesh call. Unity adds meshes from these sources to a list and attempts to instance them together. If the GameObject that a MeshRenderer component is attached to is SRP Batcher compatible, then Unity can’t instance that mesh. For more information, see SRP Batcher compatibility.
To use GPU instancing for a material, select the Enable GPU Instancing option in the Inspector.

Lighting
GPU instancing supports Unity’s Baked Global Illumination system. Unity Standard Shaders and surface shaders support GPU instancin
댓글
댓글 쓰기