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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.