So just recently updated to the 4.22 for Unreal, and had watched this video, Refactoring the Mesh Drawing Pipeline for Unreal Engine 4.22 | GDC 2019 | Unreal Engine - YouTube and he mentioned about the view matrix pointer being constant now, which I took to mean that it would be bound up in the shader variables now? atm I am doing some crazy stuff to bind out a inv view matrix to my custom shader,
FRotator ViewRotation;
player_controller_->GetPlayerViewPoint( view_origin, ViewRotation );
FMatrix ViewRotationMatrix = FInverseRotationMatrix( ViewRotation ) * FMatrix(
FPlane( 0, 0, 1, 0 ),
FPlane( 1, 0, 0, 0 ),
FPlane( 0, 1, 0, 0 ),
FPlane( 0, 0, 0, 1 ) );
if ( !ViewRotationMatrix.GetOrigin().IsNearlyZero( 0.0f ) )
{
view_origin += ViewRotationMatrix.InverseTransformPosition( FVector::ZeroVector );
ViewRotationMatrix = ViewRotationMatrix.RemoveTranslation();
}
// Calculate view matrix
FMatrix viewMatrix = FTranslationMatrix( -view_origin ) * ViewRotationMatrix;
int32 X = FMath::TruncToInt( LocalPlayer->Origin.X * LocalPlayer->ViewportClient->Viewport->GetSizeXY().X );
int32 Y = FMath::TruncToInt( LocalPlayer->Origin.Y * LocalPlayer->ViewportClient->Viewport->GetSizeXY().Y );
uint32 SizeX = FMath::TruncToInt( LocalPlayer->Size.X * LocalPlayer->ViewportClient->Viewport->GetSizeXY().X );
uint32 SizeY = FMath::TruncToInt( LocalPlayer->Size.Y * LocalPlayer->ViewportClient->Viewport->GetSizeXY().Y );
FIntRect UnconstrainedRectangle = FIntRect( X, Y, X + SizeX, Y + SizeY );
FSceneViewProjectionData ProjectionData;
ProjectionData.SetViewRectangle( UnconstrainedRectangle );
FMinimalViewInfo OutViewInfo;
if ( player_controller_->PlayerCameraManager != nullptr )
{
OutViewInfo = player_controller_->PlayerCameraManager->GetCameraCachePOV();
OutViewInfo.FOV = player_controller_->PlayerCameraManager->GetFOVAngle();
player_controller_->GetPlayerViewPoint( OutViewInfo.Location, OutViewInfo.Rotation );
}
else
{
player_controller_->GetPlayerViewPoint( OutViewInfo.Location, OutViewInfo.Rotation );
}
FMinimalViewInfo::CalculateProjectionMatrixGivenView( OutViewInfo, LocalPlayer->AspectRatioAxisConstraint, LocalPlayer->ViewportClient->Viewport, ProjectionData );
FMatrix ProjMatrix = ProjectionData.ProjectionMatrix;
inv_view_projection = ProjMatrix.Inverse() * ( FTranslationMatrix( -viewMatrix.GetOrigin() ) * viewMatrix.RemoveTranslation().GetTransposed() );
Was wondering what include I could put in my shader to get access to the camera view if this was now possible, as nice as this camera code here is, its a frame behind what it needs to be for my shader.
The only includes I have in my shader is #include “Common.usf”