Creating Textures Using Blueprints and Render Targets

A demonstration of how to use Blueprints and Render Targets to create Textures in UE4.

Windows
MacOS
Linux

Creating_Textures_Header_00.png

When creating Textures for your Unreal Engine 4 (UE4) project, you will generally need to use an external 2D painting program like Adobe Photoshop or GIMP. While authoring content in this manner can give you amazing results, there are some instances where having the ability to create content like this inside of UE4 would be helpful. In the following How - To, we will take a look at how you can use Blueprints and render targets to create Textures for your UE4 projects by first creating a new empty level in a UE4 project and then creating and setting up the render targets for use.

1 - Project Setup

Before we get started, there are a couple assets that we'll need to create as part of our project setup.

Create a New Empty Level

Creating a new Empty Level to place your Texture creation Blueprint in will make things easier to manage, ensuring that nothing else is affecting your Texture creation process. To create a new Empty Level inside of UE4, you will need to do the following:

  1. From the Main Toolbar, go to File > New Level.

    New_Level_01.png

  2. From the New Level window that is displayed, click on the Empty Level option.

    New_Level_02.png

  3. After clicking on the Empty Level option, UE4 will load a new level that has nothing inside of it. Once that has happened, save the level by clicking on the Save button on the Main Toolbar, naming it BlueprintTextureCreation.

    New_Level_03.png

With the level now created and saved in the next section we will go over creating and setting up the required assets.

2 - Required Asset Creation & Setup

In this section we will go over how to create and setup the required assets so you can create Textures using Blueprints and Render Targets.

Material Creation & Setup

  1. Right-click in the Content Browser and from the Create Basic Asset section, select the Material option to create a new Material.

    Create_RTT_Material_01.jpg

  2. Name the Material RT_Material_00 and then double-click on the material to open it up in the Material Editor.

    Create_RTT_Material_02.jpg

  3. With RT_Material_00 open in the Material Editor, add the following Material Expression nodes to the Material Graph.

    • Texture Coordinate

    • Constant

    • Append

    • Noise
      Create_RTT_Material_03.jpg

  4. Once the required Material Expression nodes have been added to the Material Graph, connect the nodes so that they match the image below, pressing the Apply button when completed to compile the Material.
    Create_RTT_Material_05.jpg

3 - Render Target Creation & Setup

  1. Open up the UE4 Editor and then right-click inside of the Content Browser. From the menu that is displayed, locate the Create Advanced Asset section.

    Create_RTT_01.jpg

  2. From the Create Advanced Assets menu, mouseover the Materials & Textures section and from the asset list that is displayed, select the Render Target option.

    Create_RTT_02.jpg

  3. Name the newly created render target RT_00 and when completed, the Content Browser should now look like the following image:

    Create_RTT_03.jpg

4 - Blueprint Setup

With the render targets and needed Materials setup and ready to use, it is now time to bring everything together using a Blueprint. In the following section, we will go over how to setup all of the various parts of the Height Field Painter Blueprint.

Blueprint Creation & Setup

To create a Blueprint that will work with both render targets and Materials, you will need to do the following.

  1. 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.

    Create_Blueprint_01.png

  2. From the Pick Parent Class window, select the Actor class and then name the Blueprint BP_Texture_Creator.

    Create_Blueprint_02.png

  3. 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.

    Create_Blueprint_03.png

  4. Add the following Blueprint nodes to the Event Graph:

    • Custom Event

    • Draw Material to Render Target

    Create_Blueprint_04.png

  5. 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.

    Create_Blueprint_05.png

  6. 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 RT_Material_00.

    Create_Blueprint_06.png

  7. Now, click on the Construction Script tab and drag off the Construction Script node to display the Executable actions menu.

    Create_Blueprint_09.png

    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.

  8. 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.

    Create_Blueprint_07.png

  9. Finally, press the Compile and Save buttons to compile and save your Blueprint.

    Create_Blueprint_08.png

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.

5 - Texture Creation & End Result

In this section, we will take a look at how to bring all parts of this how to together so that we can create and save Texture assets based on the Material that was created.

Texture Creation

Now that all of the required parts have been created and set up, we will take a look at how to create and save the Textures that are created.

  1. Locate the BP_Texture_Creator Blueprint in the Content Browser, dragging it into the level.

    Create_Textures_01.png

  2. Locate the RT_Material_00 Material in the Content Browser and double-click on it to open it up. When opened, select the Noise Material Expression node.

    Create_Textures_02.png

  3. With the Noise Material Expression selected, go to the Details panel and input the following values into their respective parameters. When completed, press the Apply button to compile the Material.

    Create_Textures_03.png

    • Scale: 2.0

    • Levels: 8.0

    • Output Min: -0.01

    • Level Scale: 3.0

  1. Select the BP_Texture_Creator Blueprint that was placed in the level and move it slightly in any direction to update the RT_00 render target that is in the Content Browser. When you do this, you should see the RT_00 render target update and display exactly what was in the RT_Material_00.

    Create_Textures_04.png

    Anytime you want to see or update the changes that were made in the Material, you will need to [slightly] move the Blueprint.

  1. Inside of the Content Browser, right-click on the RT_00 render target and in the Render Targets Actions section of the menu, select the Create Static Texture option to create a new Texture asset that will display the output of RT_Material_00.

    Create_Textures_05.png

End Result

When completed, you should have a new 2D Texture that will display the contents of RT_Material_00 that is now ready to be used in any other Material of your liking.

Create_Textures_06.png

Remember that in order to see your changes you will need to make sure that you compile your Material and [slightly] move your Blueprint so that your changes will be propagated to your render target.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback