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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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.