Download

Pause rendering and continually display the last-rendered frame

Is there a way to pause rendering and continually display the last rendered frame? I’m starting to prototype an enterprise application that runs via Pixel Streaming, and I’d like the application to consume as little GPU as possible if the user is not actively interacting with the application.

I don’t want to show a black viewport or anything, and I do want anything that is not the rendering to continue on. If the viewport isn’t changing frame-to-frame, I just want to stop consuming GPU resources to render the same frame over and over again.

Any clues? Being an enterprise application there aren’t going to be any animated things like shaders that change frame to frame even when the geometry is motionless, so I will be able to set a flag when things aren’t moving and unset it when things do move, so that rendering pauses are invisible to the users.

C++ and Blueprint solutions are both fine.

Thank you.

What you could do is rendering to a renderTarget and show that via a widget. I am not sure if there is a PauseRenderer command, but at least you can set t.maxFPS 1 which will only render one image/sec in the background.
You then can recover to interactive rendering by “listening” to various events like key inputs or camera movement in general.

ok the Max FPS idea is a good one. I had not considered that. Thank you.

AFAIK, the command to freeze rendering is simply FreezeRendering.

FreezeRendering is only working in Editor and its not really Freezing the Rendering it just freezes the culling, but rendering will continue…

Is there a master who can add

There’s no better answer to this question? Setting max fps to 1 one make the pause UI to run at 1fps.
Usualy when you pause a game to open a menu, fps jump really high because the background rendering is frozen but that’s not what happens in UE4 with the pause command

I would use a combo of things.

First, take the screencapture to use on the UI.

Second, transition to an empty level or an empty part of the same level (so things don’t necessarily need to unload and re-load).
The inside of a closed box, 1 drawcall. I wouldn’t mess with the light settings or anything, since it can potentially cause more drag on the CPU.
Actually. you can spawn the box around the camera and destroy it afterwards… you just need to make sure that it culls the outside meshes.

Third, setting the game time slomo to 0. (Set gametime dilation is the node i think).
menus can be set to ignore the dilation.

Effectively pausing the movement of everything makes it so that no updates need to run. On anything. Even cpu wise technically. I believe that the regular tick group is affected, so you should be freeing up the CPU with that.
Obviously you need to test to see if this is true (stat unit can tell you, but also running the game and looking at the cpu % on task manager may be better).

That’s about it.
going back to normal would be as simple as destroying the box and returning dilation to 1.

one last note.
I dont think we have this in BP. So I’d use C++ to use this specifically to run the sequence of events

https://docs.unrealengine.com/en-US/API/Runtime/Engine/Engine/UGameViewportClient/LostFocus/index.html

That’s a lot of “dirty tricks” while most engines can simply freeze world rendering

Functions are not set to “tick while game pause” by default so the “pause” command stop every tick by default.
The problem is only about GPU keeping rendering everything even when the game is paused.

Time dilatation is not affecting rendering, only animation/tick speed but a frame will take the same time to render

I am not to sure about the rendering… thing is, you want to have a pause where only part of the rendering is rendered, like the Menu, but the rest is not.

Thing is, you want to have a pause where only part of the rendering is rendered, like the Menu, but the rest is not. And the decion what to render and what not can not be done by the Engine because it simply just don’t know your requirements.

But to come back to the initial Pixelstreaming question: There is a new feature “freeze Stream” in the engine which i would use and then set the max fps to 1 and pause the game. Should save you enough resources and you can do this very aggressively.

Best
realVis