UE4 Importing and Exporting Render Targets (Save and Load) using Blueprints

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey everyone so i don't know if like me you use render targets in a way to kind of display mud or deformation and snuff or where your characters might work um but yeah i've been using it and i've been struggling to find a way to learn and save the render targets between player sessions so every time i've had to kind of recreate what was already there before using using hacks um but now i found a way to actually load that data back up export it and load it back up again so if you can see here when i load the game last previous game i've been running [Music] all these paths and the mud near the buildings and stuff this is all from a render target and like i said before while i was doing this having problems with this i'd have to like basically record all the positions where i was painting it before and kind of go back through and paint it again um because i'm not using c plus plus i'm just using blueprints um but now i found a way to actually kind of export and re-import this data so again you can see the passant there and then if we load it back up again you can see that this the apps are back in again and if i show you so you can see here like it's not actually showing there annoyingly but you can see um scale this up that represents what was there before you see the circular path and stuff and again if i show you there that's how it looks um so yeah to do this um what i did was so when i'm saving the game i call this function here and inside here we have this export to disk uh function and for this i've linked it to the render target so in this case this would be this render target here the one that i'm using for the mud um and we export this for the directory of the file name i get the project directory and then i have it on with mud.png this i haven't tried this in a cooked build yet or a package build so i don't know how this works it might actually do something else actually get something else more local but the minute this actually returns the directory of the of the the game and then mod.png if you don't use this i can't quite remember where it ends up but it was quite difficult to find things actually in the engine binaries in the unreal engine binaries folder not actually in your projects folder so if you can't find it it should be there um and then what you're also going to do here is have this options here so what you can do is just click make it expand this i choose png compression quality 100 you want to overwrite the file then you will have to create a dispatcher here as well a delegate sorry so i've already made one which was called what's your safety it's just uh it just returns a boolean uh whether it's succeeded or not um okay you don't have anything on that but you do actually need that attached to this otherwise if i do this it'll flag that as an error um so that's my save function and then when i want to load it i do this so this is the path i was having trouble with before um so what i'm doing here is i am importing a file as a 2d texture again exactly the same file name as before that's important so you get the right file um i'm checking whether it's valid and if it is what i do then is then i create a material instance so this load mud material is just basically a blank um material i'm using inlet it doesn't have to be there but this and then i'm feeding the texture in here so this is just a texture parameter um you can leave this blank but unreal frozen if it is so i in it's just all it is it's just a texture parameter um and then here the file that i imported to the png i'm actually setting that as this here so this this material now is just basically a texture of this um and then once i have this i then draw this onto the render target so it's basically what it's basically doing is taking the render target when i save it exporting that out as a as a texture somewhere and then when i load it back in i'm basically grabbing that exported texture using that put it in the material and then like pasting it over my render target so my render target then has just been painted down with what was there before and then it's free to continue editing on again um so i'm sorry just kind of um so if i'll show you how we can continue this if i select the path and you know draw some path here so we have an extra path here i'll save it and then i will load it back up again and never half is there and if we look at the you can see the path is back there again um one thing i also had to do here i think i did this anyway was to change this to an rgb a8 uh that was circuit export is a png so if you're having problems i would change it to that file as well so hopefully that will help you if you need to import and export render targets uh like i said i don't know if this works for definite in a package build i'm still using the in the editor um but i had a look at the functions inside the sequence functions and none of them have the if in editor hashtags so it should be should be fine cool thanks everyone
Info
Channel: Meeki Games
Views: 8,660
Rating: undefined out of 5
Keywords: UE4, Unreal, Render Target, Render targets, Blueprint, Blueprints, import, export, save, load, exporting, importing, texture, material, export to disk, png, Export render target unreal, import render target unreal, loading in unreal, saving in unreal, export texture, import texture, exporting textures in unreal, material render target, 4.26, Project, game, package, Engine, Game engine, game software, game dev, game development, games development, indie, title, Meeki Games, Peasants, RTS
Id: bb_yw5Cvs6k
Channel Id: undefined
Length: 6min 20sec (380 seconds)
Published: Wed Jan 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.