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
- SystemInfo.get_graphicsDeviceName() is generating garbage GC Alloc when using Metal graphics API
- Crash on D3D12CommonShader::ApplyGpuProgram when attaching material which samples "_UnityFBInput0" to "Full Screen Pass Renderer Feature" Component
- SpeedTree meshes and objects count differs when comparing the numbers in the Player with the Editor
- Model and Prefab Preview icons are not updated after upgrading associated Materials to URP
- Game view is rendered white when viewing the Editor with HDR display and Post Proccesing is enabled on the Main Camera with 2D URP
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