Clear Backbuffer or RenderContext

In UE4 (4.8.2) how do I clear the backbuffer? I’d like to make sure that it is cleared.

Also, how do I set the clearcolor? Get a graphicsdevice or rendercontext?

Thank you.

Is there a way to do this with GEngine?

I’ve perused through the Rendering & Graphics documentation (, albeit in a cursory manner, but nothing jumps out at me there. I also combed through GEngine, UWorld, UGameViewport(Client), FScene interfaces, and found that FCanvas has a Clear( FLinearColor ) function. Unfortunately I can’t get a:

GEngine->Viewport->Canvas->Clear( . . . )

call in my GameMode BeginPlay function.

Can someone please provide a link that describes the steps I need to take to clear the backbuffer/rendertarget with a specific color.

Thank you.

I need to keep this at the top…

Not sure if this works just as well for your purposes, but have you considered APlayerController:ClientSetCameraFade?


For FadeAlpha pass something like FVector2D(0.0f, 1.0f). It’ll start from nothing and go to opaque with the colour you desire over the time you give it.

Thank you Max.

The function looks like it might help in another area, that is fading the screen between scenes, but really doesn’t address the issue that I’m trying to resolve.

That’s unfortunate. Perhaps if you describe in detail what you’re trying to accomplish someone could provide an exact/alternative method to do what you desire, i.e. what do you hope to gain by clearing the backbuffer?

By what I know, the easiest access to Canvas is through the HUD class while inside the DrawHUD( ) method where the HUD.Canvas is “active”.
I don’t remember well, but until the viewport things pass by it, so a Clear called before a Super:: DrawHUD() should do the trick.