Search Issue Tracker
Won't Fix
Votes
1
Found in
2019.4
2020.2
2020.2.1f1
2021.1
2021.2
Issue ID
1311395
Regression
No
Custom View/Projection matrices not used when drawing Meshes with the CommandBuffer
How to reproduce:
1. Open the user's attached project
2. Enter Play mode
Expected results: When using the CommandBuffer to draw a mesh, the Projection and View matrices are used that have been set
Actual results: The Projection and View matrices set in the command buffer are not used, but the Projection matrix of the active camera is used when using the CommandBuffer to draw a mesh
Reproducible with: 2019.4.20f1, 2020.2.6f1, 2021.1.0b7, 2021.2.0a6
Could not test with: 2018.4.32f1 (Errors downgrading)
Note:
Reproduces with: HDRP
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
- [HDRP] Game view doesn’t refresh after changing Camera Background Type until mouse moves over it
- Some Shaders appear twice in Material Shader selection menu
- Editor freezes with a StackOverflowException when certain asset types are assigned to a managed component in a SubScene via AddComponentObject
- Scale Snapping with Gizmos does not work in the Scene view when Snapping and Absolute Grid Snapping are toggled off
- Text Script Importer Reference button links to a Missing Page when clicking the Reference Button in the Inspector
Resolution Note:
As HDRP uses its owns shader constants, legacy functions like CommandBuffer.SetViewProjectionMatrices will not work. There is no equivalent function in HDRP at the moment. A workaround for a simple case like this is to still use CommandBuffer.SetViewProjectionMatrices and write the shader like a builtin pipeline shader (using UnityObjectToClipPos(v.vertex) and including UnityCG.cginc). This will work as long as the shader is custom and does not use HDRP functionalities.
That being said, we do want people to use HDRP shader library so we are looking into providing the proper API for such cases. For this reason we are closing the bug and we have added the task to our backlog. In the meantime please use the workaround above.