Saving RenderTargets in VR Game. Need Help

tdlr; Cannot get Rendertargets to save in project files or on disk. Currently making blank png files instead.


I am once again asking for your help with Rendertargets.

I have a painting program in VR using Rendertargets! It is going great. But now I need to save the Rendertarget textures to 1) Make an Undo button and 2) Use the texture in other parts of the game.

I followed this very helpful tutorial UE4 Importing and Exporting Render Targets (Save and Load) using Blueprints - YouTube

Unfortunately the exporting is not going well. One of my friends theorizes it is because of “Forward Rendering” (Which is usually used in VR projects). I am worried that something in 5.1 broke since the tutorial was made. But I cannot find any resources for this problem. I am also very new to saving things in game, so it could just be personal ignorance of the subject.

Here is a glance at my code. I double checked the tutorial and am currently getting blank Texture files exported. I can see that my Rendertarget is saving the painted on texture, but it’s not exporting.

The render target itself with some blotches of paint.

I am no longer receiving errors, but am not seeing any color textures (Just exporting a blank empty texture that is named correctly).

— Added note, the “draw Render Target to Material” does work, I can see the texture appear after using it in editor. Not sure if this works during runtime.

If this looks familiar to you and you have any advice or resources then please let me know. Thank you so much! If you have a similar predicament or are curious please comment and we’ll figure this thing out together. Thank you!

1 Like

Update:

Friend and I stared at it for a while. He is a Tech-artist with more experience.

We have determined that we cannot access the data of Render Target texture. Even if we save a material to the RT texture, see the RT texture exists with the painted on details in the content editor. And then export the texture FROM the content editor, the file that we export is a totally blank image.

When we used a texture file (Android icon) and hooked it up to the export and it worked perfectly. So it’s just the Rendertarget texture itself, or it’s just the Dynamic painted on material. No matter what I do I can’t seem to access the data of my ‘being painted on’ material as a file. :thinking:

By the way we solved this.

So if you’re looking for help in this subject this is how we did it.

Our programmer who does C++ put the linked functions into a UE5 node for me, we got it running on the project and now I can call “ExportRenderTarget2DAsPNG”. The function works with my variable RenderTargets that are edited and made in my Blueprint. So we can now export these as textures, and use those textures in other parts of the game. Which is fantastic!

FImageUtils | Unreal Engine Documentation

Pay attention to the settings of the “type” of PNG you’re working with. Otherwise you can get weird coloring and effects to your PNGs. I am going with “RTF RGBA8”.

Hope that helps someone in the future!