Search Issue Tracker
By Design
Votes
0
Found in [Package]
12.0.0
Issue ID
1329450
Regression
No
[URP] unity_LightData and unity_SpecCube0_HDR equal to 0 on build, for render pass that use CommandBuffer.DrawMeshInstanced
How to reproduce:
1. Open attached project "450_12_repro.zip"
2. Build the project
3. Start the build
Expected result: The color of the 9 circles is the same color compared to the color in the Editor - white
Actual result: The color of the 9 circles is different - black
Reproducible with - 7.5.2 (2019.4.25f1), 10.4.0 (2020.3.5f1), 11.0.0 (2021.1.5f1), 12.0.0 (2021.2.0a15)
Not reproducible with - 2018.4.33f1 (no URP)
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
- NullReferenceException when setting 'isTextObjectScaleStatic' to false on a disabled TextMeshPro GameObject
- Shader Stripping Custom Options disappear when exiting Play mode without reloading Domain
- Decals do not get projected when 'Rendering Layer Mask' on a GameObject is 23rd Layer or above due to encoding/decoding issues
- Deriving from SearchContextAttribute doesn't always work
- Scripting API documentation is missing for macOS editor extensions
Resolution Note:
When drawing with command buffers you are taking a shortcut to the graphics device to issue a draw instanced command - this means that there is _no_ calculation for per object data like light info or spherical harmonics or similar.
if you wish to have Unity calculate this for you then you need to emit these as an intermediate renderer in an Update call per frame. This means they will be part of the normal scene processing (which happens at culling time) and the per instance data will be generated.
My recommendation is to emit this geometry at scene time with your attached material using Graphics.DrawMeshInstanced - then in your renderpass do a drawrenderers using your pass name on the context. This should result in all the per instance data being configured as you would expect.