Hi, I am trying to take a screenshot of the current view when the user saves the sceen so I can display a thumbnail for the loading part. The best solution I have found so far is to use a scene capture 2d to take a capture and save it to a render target. This works as it is suposed to, because I can see the thumbnail of the render target updating in the editor. The problem I have is that I don’t know how to retreive this image so that I can save it to a save slot. Is it possible to somehow convert the render target into a Texture 2D or something similar so that it can be put in a save slot object? Or is there any better way to do this?
It’s possible, I did it about 2 days ago. It’s neither too hard, nor “easy money”. Yes, it’s possible to write a captured image from “SceneCaptureComponent2D” to the saving game slot, and loading this image back. But, as for me, better way would be, if you do an image with some sketch of your level. At least, I decided to choose this way. It has such advantages, as:
using a statical image (brush material) much easier than headache with “SceneCaptureComponent2D”;
you do not need to create any additional necessary components (like “Render target” and “Material” - they costs RAM);
you do not need to control your “SceneCaptureComponent2D” camera (enabling it for the moment of saving, and disabling after save).
If someone need, I can try to record a little test video with this released idea.
By the way, I BPed it only by my hands, without using any plugins. Vanilla BP - nothing more.
HEGI, maybe I was not correct:I can record a final video, but not a tutorial, because it’s too complicated to explain, but not to do. To record a real tutorial, I need much more time, than I have for now.
No problem, it seems too complicated to do in blueprint anyway. I have done it in C++ now, wich is very straightforward and clean.
It saves a thumbnail, based on the name of your save game file. So you don’t need to save any image data or file path’s there.
You just need to pass a render target to the export.
If anybody is interested, here is complete code from my function lib. Just need to merge it yourself.
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.
Thanks,your method is effective,but why can’t directly convert the TextureCapture2d to Texture2D,I guess the reason is that texture2d need a uasset stored on hard drive,so it’s necessary to create a file on hard drive.
In Unreal 5.4 here is an example of Base64 encoding a texture and decoding it and creating the UTexture2D. Currently using this to upload images to a cloud service.