How to access camera view as an image without taking screenshot in Unreal Engine?

I know I can take screenshots using following:

GetWorld()->GetGameViewport()->Viewport->TakeHighResScreenShot();

It saves a screenshot in <Project>\Saved\Screenshots\Windows. But I want more control over the image. Is it possible, say, to access individual pixels?

Is it possible to get what’s on the screen as an image object (and maybe also save it in a custom location)?

You can spawn a scene capture 2d at your camera location and render the scene capture to a render target. Then you can do whatever you want with that render target.

Hey there! I’ve tried spawning SceneCapture2D and then rendering the scene capture to a render target. I was not able to save the resulting Texture2D to a SaveGame file directly (was resulting in a black image) but I was able to save the Texture2D to an actual file on the HDD. I know using C++, this is a rather easy task but I’ve managed to do it in Blueprints only since there were a lot of people interested.

Save the thumbnail image to HDD as binary: Save slot thumbnail image posted by anonymous | blueprintUE | PasteBin For Unreal Engine
Load the binary thumbnail image from HDD: Load slot thumbnail image posted by anonymous | blueprintUE | PasteBin For Unreal Engine

This is tested on Windows with UE 4.27. I would be happy if someone confirms it works on other platforms as well. Cheers!

1 Like