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
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
- Scene view has Y coordinates of the Screen Position node flipped when some of the URP features are disabled
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
- Files in the target folder are deleted without a proper warning when building an iOS project
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.