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!

Greetings

2 Likes

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);
2 Likes

You saved my life, thank you so much

I also ran into this and after some searching found there was a plugin project setting that solves this without any custom code required: Plugins → Movie Pipeline in Editor → Resize PIEWindow to Output Resolution.

I found even with -ForceRes set as the tooltip suggests I needed a monitor with a resolution at least equal to what I was rendering, with my 4k monitor rendering a movie at 4k I needed to disable DPI scaling and hide the windows taskbar before I clicked render or it couldn’t make the PIE Window big enough and the issue still occured.