#Changing Projection Matrix Breaks Post Processing

1 messages · Page 1 of 1 (latest)

north cobalt
#

Hello, I am using HDRP and have a camera rendering to a render texture. When I try to rotate the camera's near clipping plane (by changing the camera's projection matrix and using oblique projection), post processing seems to not function as intended, namely fog. Below are two images, one where the matrix is unmodified, and one where the matrix is modified.

I run the following in Update():

    Plane p = new Plane(transform.right, transform.position);
    Vector4 clipPlaneWorldSpace = new Vector4(p.normal.x, p.normal.y, p.normal.z, p.distance);
    Vector4 clipPlaneCameraSpace = Matrix4x4.Transpose(Matrix4x4.Inverse(surfaceCamera.worldToCameraMatrix)) * clipPlaneWorldSpace;
    var newMatrix = playerCamera.CalculateObliqueMatrix(clipPlaneCameraSpace);
    surfaceCamera.projectionMatrix = newMatrix;```

Where ```surfaceCamera``` is the camera that renders to the render texture

If anyone could advise me on how to stop this from happening, I would be really appreciate it!
Thanks!