How to change the Movie Render Queue Viewport size?

Hey, I’m triggering an event from a Sequence while rendering, using the Movie Render Queue. In that event im trying to project a 3D point onto the 2D Screen using ProjectWorldLocationToScreen(). In the Movie Render Queue this Viewport seems to be set to 1280x720 by default. Can we change this Viewport size so that the projection is correctly calculated? I would need it to be the same size as the rendered output. In my case that would be 1920x1080. Thanks a lot!


1 Like

Do you find a solution? I also want it to be 1920x1080 and here my viewport is 1600x900 by default.

I projected to the screen using a USceneCapture2D.

Get the ViewInfo first somewhere:

FMinimalViewInfo ViewInfo;
USceneCaptureComponent2D* CaptureComponent; //Initialize this first somewhere
CaptureComponent->GetCameraView(0.0f, ViewInfo);

then call this function to project it from WorldPos to ScreenPos:

bool Project2Screen(FMinimalViewInfo& CapturedView, const FVector& ViewLocation, const FRotator& ViewRotation, const FVector3d& WorldPos, FVector2d& ScreenPos, int32 ImageHeight, int32 ImageWidth)
    ScreenPos = FVector2d(0.0, 0.0);

    const FMatrix ProjectionMatrix = CapturedView.CalculateProjectionMatrix();
    FMatrix ViewPlanesMatrix = FMatrix(
        FPlane(0, 0, 1, 0),
        FPlane(1, 0, 0, 0),
        FPlane(0, 1, 0, 0),
        FPlane(0, 0, 0, 1));

    const FMatrix ViewRotationMatrix = FInverseRotationMatrix(ViewRotation) * ViewPlanesMatrix;

    const FMatrix ViewMatrix = FTranslationMatrix(-ViewLocation) * ViewRotationMatrix * ProjectionMatrix;

    FIntRect InRect(0, 0, ImageWidth, ImageHeight);
    return FSceneView::ProjectWorldToScreen(WorldPos, InRect, ViewMatrix, ScreenPos);

    return false;

Hope this helps!

1 Like

Thanks a lot~ Your code gives me inspiration and I have resolved my problem.

Here I get the ViewInfo of my current camera.

FMinimalViewInfo MinimalViewInfo = FMinimalViewInfo();
MinimalViewInfo.Location = CineCamera->GetComponentLocation();
MinimalViewInfo.Rotation = CineCamera->GetComponentRotation();
MinimalViewInfo.FOV = CineCamera->FieldOfView;
MinimalViewInfo.DesiredFOV = CineCamera->FieldOfView;;
MinimalViewInfo.AspectRatio = CineCamera->AspectRatio;

FMatrix ViewMatrix;
FMatrix ProjectionMatrix;

UGameplayStatics::GetViewProjectionMatrix(MinimalViewInfo, ViewMatrix, ProjectionMatrix, ViewProjectionMatrix);

And I use the ViewProjectionMatrix like this to get the 2D screenPos.(SocketWorldLocation is the 3D pos I want to project)

FVector2D ScreenPos;
FIntRect InRect(0, 0, 1920, 1080);
FSceneView::ProjectWorldToScreen(SocketWorldLocation, InRect, ViewProjectionMatrix, ScreenPos);