- Home /
 
CommandBuffer.SetViewProjectionMatrices() does not have any effect, regardless of input
I'm trying to render an object to a RenderTexture using command buffers, and have had success up until this point. The object is successfully rendering from the PoV of the active camera, which is not what I want.
This is the full relevant code:
     private void Awake()
     {
         thisRenderer = GetComponent<Renderer>();
         Damage = new RenderTexture(1024, 1024, 24);
         Damage.name = "_RWDamage";
         Damage.enableRandomWrite = true;
         Damage.Create();
 
         CBuffer = new CommandBuffer();
         CBuffer.name = $"{gameObject.name} Damage";
         CBuffer.SetRenderTarget(Damage);
         CBuffer.ClearRenderTarget(true, true, Color.red);
         Matrix4x4 projMatrix = GL.GetGPUProjectionMatrix(ProjectionCamera.projectionMatrix, true);
         CBuffer.SetViewProjectionMatrices(Matrix4x4.identity, projMatrix);
         CBuffer.DrawMesh(GetComponent<MeshFilter>().mesh, Matrix4x4.identity, DamageMaterial, 0, -1);
     }
 
 
     private void Update()
     {
         Graphics.ExecuteCommandBuffer(CBuffer);
     }
 
               Supposedly the "SetViewProjectionMatrices" function should modify the PoV of the CB's render, but it doesn't change the final output at all - why, and how can I achieve what I aim to do?
2020.2.1f1 & HDRP 10.2.2
What's actually happening: https://puu.sh/HcSHC/f2e6636e62.mp4
Note that the CB's draw is following the camera's perspective (and aspect ratio)
Your answer
 
             Follow this Question
Related Questions
How to make a custom GrabPass-like sampler2D in MRT shader? 0 Answers
Limiting player view dependent on position and obstacles 0 Answers
How do i change the Alphasorting Center to the Pivot in Meshrenderers? 0 Answers
RenderTexture lacks quality , Trees have a grey outline against the night sky 0 Answers
How to read self when CustomRenderTexture dimension is Tex2DArray 0 Answers