Download

Save game & thumbnails

Hi

I want thumbnails in my SaveGame :wink:
I’v digged up ‘GetViewportScreenShot’ function and it works just fine in Editor (makes screenshot, and returns TArray<FColor> to me), but it fails messerably in package & standalone game :confused:

It returs black image and takes insane amount of time :confused:
(Insane ==> my games run at 60FPS, and calling GetViewportScreenShot in Standalone game takes about 5 - 6 seconds !! (stepping outs in VS leads to FlushRenderingCommands(); takes all this time)

any other ideas how to take screenshot for savegame thumbnail ? (the idea should be bulletproof between PC and PS4),

Hi.
You can try dig into render to texture engine code.
Like FRenderTarget.ReadPixels.
But i dont know about PS4 compatibility. It seams that it is, because PS4 has materials with reflection.

but I need to read it from SOMEWHERE :wink:
Currently I’v done this:
UGameViewportClient* ViewportClient = World->GetGameViewport()
GetViewportScreenShot(ViewportClient->Viewport, …)
but ViewportClient->Viewport->GetRenderTargetTexture() is EMPTY in Package (in editor it have proper value)

My other idea (with I do not like much) is to have USceneCaptureComponent2D component around somewhere and divide SaveGame into two ticks, in first tick save all data I need into the archive and place USceneCaptureComponent2D where my main camera is, and call UpdateContent() on it, on the next tick just grab contnent of USceneCaptureComponent2D bound TextureTarget and read pixels from there, and finish making save (save thumbnail & archive) … while this method works, it seems ‘little’ overcomplicated and have issues (the thumbnail sshot is not identical to the game screenshot (some postprocessing effects does not appear in capture and there is visible shutter (normally frame takes 16ms, while the frame when the capture is rendered takes about 60ms :/)
(writing my stuff to archive takes about 3 - 4 ms, so it’s not that).

Hi,man,Has your problem been solved?I have the same problem with you。thanks.

Yeah, same here.