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)
Comments (1)
-
liyonghelpme3
Nov 12, 2021 15:55
so no way to use command buffer to optimise rendering
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
- [Android] Stage information is not logged when Log Shader Compilation is enabled
- [Vulkan] The memory allocation increases rapidly when there are multiple (three or more) Real-Time Reflection Probes in the Scene
- [macOS] Library folder of the opened project can be deleted which leads to the crash
- “Default Scene” dropdown field contains a spelling mistake “Default Builtin”
- Editor crashes on PPtr<Mesh> after adding Text Mesh and Cloth Components to the same GameObject
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.