How do I get the projection matrix?

For a shader I have I need to pass in the view projection matrix. I know how to calculate the view matrix, just the inverse of the camera’s transform. I cannot figure out where the get the projection matrix though. Does anyone know how? I know in Unity it was just unity_MatrixVP.

1 Like

I think View.ViewToClip should hold the “Projection” matrix, and View.WorldToView should be the “View” matrix. Alternatively, if you need the combined “ViewProjection” matrix, you can used View.WorldToClip.

1 Like

Maybe in this way:

				auto* ViewportClient = GetWorld()->GetGameViewport();
				FSceneViewProjectionData ProjectionData;
				UGameplayStatics::GetPlayerController(this, 0)->GetLocalPlayer()->GetProjectionData(ViewportClient->Viewport, eSSP_FULL, /*out*/ ProjectionData);
				const auto& ProjectionMatrix = ProjectionData.ProjectionMatrix;