Blueprint Creation & Setup
To create a Blueprint that will work with both render targets and Materials, you will need to do the following.
Right-click in the Content Browser and from the menu that is displayed in the Create Basic Asset section, select the Blueprint option to create a new Blueprint.
From the Pick Parent Class window, select the Actor class and then name the Blueprint
Double-click on the
BP_Texture_Creator Blueprint to open it up and once opened, click on the Event Graph tab to open up the Event Graph.
Add the following Blueprint nodes to the Event Graph:
Select the Custom Event node and press F2 so that you can rename the Custom Event node to
Bake. Then, connect it's output to the input of the Draw Material to Render Target node.
Next, on the Draw Material to Render Target node, load the render target that was created previously into the Texture Render Target slot by clicking on the small white triangle next to Select Asset, and then from the list, find the render target
RT_00 and select it by clicking on it. Once that is completed, do the same for the Material section, selecting
Now, click on the Construction Script tab and drag off the Construction Script node to display the Executable actions menu.
Please note that DrawMaterialToRenderTarget will not work in Construction scripts outside of the UE4 editor which means if you are trying to do this at runtime it will not work.
From this menu locate the Bake event that was created by inputting Bake into the search box and once found, click on it to add it to the graph and then connect the output of the Construction Script to the input on the Bake node.
Finally, press the Compile and Save buttons to compile and save your Blueprint.
Now that the Blueprint has been setup, in the next section, we will take a look at how you capture and save a Texture that displays what was created in the Material.