Why does the same widget look different when used by MoviePlayer vs just manually adding to viewport?

I’ve been working on a loading screen implementation for a few days, and I can’t seem to figure out why when using the MoviePlayer to render a widget via the FLoadingScreenAttributes.WidgetLoadingScreen, all the content of that widget appears smaller than if you were just to manually add that same widget to the viewport. It’s almost as if the MoviePlayer does something different with the DPI scaling. I’m attempting to make it so that once the MoviePlayer finishes playing, I will manually add the same widget to the viewport so I can hide additional loading logic (since MoviePlayer blocks the game thread). I wanted to hide the swapping but because they don’t look the same, it just ends up looking wonky. I don’t have any scale or size boxes in my widget, just text and a throbber.

I’ve even tried creating an SVirtualWindow that is identical to what the MoviePlayer uses to manually display my widget and they still look different.

I’m at a loss here and any insight would be greatly appreciated.

Hello! Code that is used by Movie Player create several different things

  1. It uses VirtualRenderWindow = SNew(SVirtualWindow).Size(GameWindow->GetClientSizeInScreen()) as window container
  2. Inside it LoadingScreenContents = SNew(SDefaultMovieBorder)
  3. First slot of LoadingScreenContents widget contains MovieViewport
  4. Second slot of LoadingScreenContents widget contains SDPIScaler
  5. SDPIScaler contains SBorder with paddin 0
  6. And SBorder at last conatins WidgetLoadingScreen widget, that you push through the attributes

So there is some hierarchy diffs. Second thing - this virtual window is rendered by Slate Renderer on Main Window viewport and that also could cause some diffs…

Thanks for the response! So when I mentioned in my original post that I created an identical SVirtualWindow hierarchy, I did exactly what you mentioned in steps 1-6 and they still look different. So I guess it has got to have something to do with the fact that it is rendered via the slate renderer like you mentioned in your final point. I was trying to avoid attempting to mimic the rendering code but I guess that is the only thing left I haven’t tried…

So turns out it was an issue with the FDefaultMoviePlayer’s implementation of GetViewportDPIScale(). It was always returning a value of 1 which seems undesirable. Anyway, this is how we fixed it:

float FDefaultGameMoviePlayer::GetViewportDPIScale() const
{
	if (MainWindow.IsValid())
	{
		FVector2D ViewportSize = MainWindow.Pin()->GetClientSizeInScreen();
		return GetDefault<UUserInterfaceSettings>()->GetDPIScaleBasedOnSize(FIntPoint(ViewportSize.X, ViewportSize.Y));
	}

	return 1.f;
}
1 Like