In this post I’m going to show you how to create procedural textures inside the editor. While in the following example we will generate a 1024 x 1024 texture using random RGB values, the same approach can be used with different generation algorithms to achieve your goals. This post was written using 4.22 version of the engine so you may have to modify the following code in case you’re using a newer version.

The whole process takes place in a single c++ method (named GenerateTexture) that:

  1. Generates the asset file inside the editor
  2. Creates the pixel data
  3. Copies the pixel data to the file
  4. Saves the asset when the above steps are completed

In order to test the following code, I created a C++ class that inherits the actor class and then inside the BeginPlay function I called the GenerateTexture method:

Here are a couple of textures that were generated by the previous algorithm: