Search Issue Tracker

By Design

Votes

3

Found in [Package]

9.0.0-preview.33

Issue ID

1266291

Regression

No

[HDRP] Given shader doesn't use instancing variant when DrawProcedural() instance count is >1

Package: Scriptable Render Pipeline HD

-

How to reproduce:
1. Open attached "NoiseBall4.zip" project
2. Open Game Object's "Noise Ball" Inspector window
3. In the Script Component, notice that Instance Count is set to 8
4. Observe the Scene View

Expected result: 7 other instances of Noise Ball are visible to the right of the original
Actual result: Only one instance is visible

Reproducible with: 7.4.1 (2019.4.5f1), 8.2.0(2020.1.1f1), 9.0.0-preview.33(2020.1.1f1, 2020.2.0a19)
Could not test: 2018.4 (errors when updating the project)

Note:
- You can view the expected results by opening NoiseBall -> NoiseBall.shader, at line 309 change FORCE_INSTANCING_TO_BE_ON to 1

- FORCE_INSTANCING_TO_BE_ON defines "uint instanceID : SV_InstanceID;" rather than relying on UNITY_VERTEX_INPUT_INSTANCE_ID, which should be enabled if rendering with an instancing variant.

  1. Resolution Note:

    This is by design. Regular DrawProcedural calls will not use the built in batching instancing code and it is up to users to declare and use instance ID themselves. If you want to use the built in code for instancing you will have to use some thing like https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedProcedural.html

Add comment

Log in to post comment