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
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.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
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