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

FeatureBuilt-in Render PipelineUniversal Render Pipeline (URP)High Definition Render Pipeline (HDRP)Custom Scriptable Render Pipeline (SRP)
GPU instancingYesYes (1)Yes (1)Yes (1)

Notes:

  1. 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:

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:

To use GPU instancing for a material, select the Enable GPU Instancing option in the Inspector.

The Enable GPU Instancing option as it appears in the material Inspector.
The Enable GPU Instancing option as it appears in the material Inspector.

Lighting

GPU instancing supports Unity’s Baked Global Illumination system. Unity Standard Shaders and surface shaders support GPU instancin

댓글

이 블로그의 인기 게시물

About AActor!!! "UObject" has no member "BeginPlay"

UNREAL Android build information

C++ 생성자 위임 (delegating constructor)