Calculate Matrix from Cinemachine VCam

I want to perform some culling logic and rendering into a render target / compute buffer combo across a set of viewpoints defined by Virtual Cameras. However, it’d be very tedious to actually drag a camera around for this at build time (even more so when we talk about Dolly Tracks).

How can I calculate the matrices (camera to world and projection) from the Vcam’s m_lens property; there are a few wonky ones (e.g. “Dutch”, is that just an angle? “GateFit”? “LensShift?”)

You can do this:

var state = vcam.State;
var cam2World = Matrix4x4.TRS(state.CorrectedPosition, state.CorrectedOrientationm Vector3.one);
var lens = state.Lens;
var perspective = Matrix4x4.Perspective(lens.FieldOfView, lens.Aspect, lens.NearClipPlane, lens.FarClipPlane);