TemporalAA - insane blurring when paused

I’m working on a strategy game - but one where it’s important to be able to pause the game. We pause the game by calling

AController::SetPause( true )

We also have our own derived APlayerControllerClass where we set

bShouldPerformFullTickWhenPaused = true;

This allows the player to continue to move the camera while the game is paused.

Unfortunately the viewport becomes a blurred mess the moment the player moves or rotates the camera - all because of TemporalAA. When the game unpauses (by calling “AController::SetPause( false )”) then all of the blurring goes away. It also goes away if you manage to position the camera back at the same position and rotation that it was at when the game was paused (but obviously blurs again if you move/rotate the camera again!).

My temporary solution right now is to switch to FXAA when the game pauses and then back to using TemporalAA as soon as the game unpauses - but this does visibly change the rendering quality.

Also, it should be noted that this can be reproduced in the “Shipping” build configuration on Win64.

I’d argue that a quarter of a year is a decent amount of time to let pass before bumping a topic…

Hey Neil -

I agree you were fine to bump. The problem here is that, as the name suggests, Temporal AA requires the running tick events and the SetPause will stop the running game clock. You would need to develop a new function which halts game mechanics but does not actually pause the full game clock.

Thank You

Eric Ketchum

Hi Eric. This solution is … less than ideal for us.

Here’s the problem: our game is a simulation, and it allows the player to change the game speed at any time, on the fly. It has a set of “VCR” buttons that let you set the game to 0x, 1x, 2x, 4x, or 8x speed.

We used to set the game speed to 0, but this actually didn’t set the game speed to 0; it seemed to be clamped to a very small value (like 0.00001) and you could see stuff moving very slowly when the user hit the in-game ‘pause’ button.

So we ended up using time dilation for 1x / 2x / 4x / 8x speed, and we worked around the problem of 0x game speed not working by using the “paused” state for actually pausing the game.

I’m not sure how we would go about pausing the full simulation properly, as you suggest, including fully pausing the physics simulation.

If we set the game speed to 0, it never actually gets set to 0 … but if we use the paused state, we run into the problem in the original post.

It seems to me that there is a deeper problem here.

I think that the notion of a “tick” in Unreal is trying to represent two things: both the speed of the game itself, and the simulation it represents. And you very often want to fully pause the underlying simulation, including all the physics, without affecting rendering or UI in any way.

So it seems to me that Unreal should really have two separate tick types – the simulation tick, which is subject to pausing and time dilation, and the real-time tick, which is never paused or time-dilated in any way.

I.e. the “game speed” of the underlying simulation should be able to be modified without affecting the “app speed” of the application itself, which should always tick in real time.

And things like TemporalAA should use the real-time tick and should not be dependent on the underlying simulation at all. For it to be tied to the simulation tick as it currently is simply seems wrong.

Hey Mothership -

I can absolutely enter that as a feature request, UE-9136, I will let you know as soon as we have time to investigate further.

Thank You

Eric Ketchum

Thanks, Eric! Neil and I would appreciate that.

To be clear, this is going to be a high-profile strategy game, and we’ll be announcing toward the middle of this year. This is currently our #1 bug by a mile, and we won’t be able to ship without a fix or a solid workaround.

Do you have a sense of when you might be able to take a look at it, and whether there are any workarounds we could use in the meantime?

We’re also happy to make a build available to you guys if you think it would help in any way.

-Paul Tozour

Top-notch feature request! I have been struggeling with the same issue as Mothership and the problem also affects motion blur and DFAO.

Not sure if the method you use does a full game pause but there is some code you want to look at (maybe remove and it works like you expect it). Search for this:

if(ViewFamily.EngineShowFlags.MotionBlur && GRenderingRealtimeClock.GetGamePaused())
{
	// so we can keep motion blur in paused mode

	// per object motion blur
	Scene->MotionBlurInfoData.RestoreForPausedMotionBlur();
	// per bone motion blur
	GPrevPerBoneMotionBlur.RestoreForPausedMotionBlur();
}

I also suggest to disable motionblur and/or temporalaa to clearly identify which causes the issues. You also can do “show VisualizeMotionBlur” or “vis Velocity”

Not sure if the method you use does a full game pause but there is some code you want to look at (maybe remove and it works like you expect it). Search for this:

if(ViewFamily.EngineShowFlags.MotionBlur && GRenderingRealtimeClock.GetGamePaused())
{
	// so we can keep motion blur in paused mode

	// per object motion blur
	Scene->MotionBlurInfoData.RestoreForPausedMotionBlur();
	// per bone motion blur
	GPrevPerBoneMotionBlur.RestoreForPausedMotionBlur();
}

I also suggest to disable motionblur and/or temporalaa to clearly identify which causes the issues. You also can do “show VisualizeMotionBlur” or “vis Velocity”

I think it’s not required anymore, however, this how I resolved this problem. Create your PlayerCameraManager and override the ApplyModifiers function like this:

void AYourPlayerCameraManager::ApplyCameraModifiers(float DeltaTime, FMinimalViewInfo& InOutPOV)
{
	Super::ApplyCameraModifiers(DeltaTime, InOutPOV);

	if (UGameplayStatics::IsGamePaused(this))
	{
		InOutPOV.PostProcessSettings = PostProcessSettingsOverrideWhenPaused;
	}
}

Where PostProcessSettingsOverrideWhenPaused is a public and EditAnywhere Uproerty defined as a member of your camera manager class. In editor, just set “blur amout = 0.f” in this property, so motionBlur will be deactivated when you go into pause.

Hope it can help! :slight_smile:

Thank you so much Alessandro. I was able to apply this same logic to blueprints as well. I was able to get the first person character’s camera, and while I hit pause, I was able to change the settings of the post process on the camera, and set post process. Then, by dragging out from the set post process settings, I was able to make postprocess settings. Thanks again.

This is still an issue in 4.15. Did anyone find a solution to get AA, MotionBlur and DFAO working while paused?

If you are encountering issues with overt motion blur when you pause the game (e.g. because you’re running a level sequence while paused), you have to set bIsCameraMoveableWhenPaused to true in your World, otherwise your motion blur will work from the wrong matrices.

1 Like