Texture Gen documentation

Texture Gen lets you generate heightmaps, noise, LUTs, channel packing and detail maps straight inside Unreal Engine: installation, a guide to the twelve tools, export and troubleshooting.

Installation and requirements

Requirements

  • UE version: Unreal Engine 5.8
  • IDE: Visual Studio 2022 (with a compatible MSVC compiler)

How to install it

  1. Copy the plugin folder UETextureGen into the Plugins/ directory of your Unreal Engine project (for example YourProject/Plugins/UETextureGen).
  2. Right-click the .uproject file of your project and choose Generate Visual Studio project files.
  3. Open the .sln solution that is generated in Visual Studio and build the project in Development Editor mode.
  4. Open the Editor, go to Edit > Plugins, look for UETextureGen and make sure it is enabled.
  5. Restart the Editor if you need to.

How to use it

The plugin has two main ways of working: the Tools Window and the texture context menu.

A. The main Tools Window (Window > UETextureGen Tools)

You open the main tools window from the Editor menu Window > UETextureGen Tools, or by clicking the UETextureGen icon in the main toolbar (Play Toolbar). The window is split into 12 tabs:

1. Heightmap (terrain generator)

Generates procedural heightmaps made of several layers of noise combined, with a simulation of hydraulic erosion.

  • Main parameters:
    • Resolution: width and height of the texture that is generated (sizes that suit Unreal landscapes are recommended, such as 1009x1009).
    • Seed: a number that seeds the random generator.
    • Global Mask Radius: applies a circular fade mask to the edges (from 0 to 1), ideal for making islands or isolated mountains.
    • Erosion Iterations: number of passes of the simulated hydraulic erosion, which runs on the CPU. It makes the terrain far more realistic, carving ravines and leaving sediment deposits.
    • Layers: adds more layers of noise on top of the base one, each with its own scale, angle, strength, offset and octaves.

2. Noise (procedural noise)

Generates a single procedural noise map that tiles (repeats with no seams).

  • Noise types: Perlin, Cellular, Billow, Ridge, Fractal, Worley.
  • Parameters:
    • Scale: the spatial frequency of the noise.
    • Octaves: the level of detail of fractal noise.
    • Persistence: how much the higher octaves weigh on the final result.

3. LUT (colour lookup table)

Generates a neutral 3D or 2D texture for colour grading (a LUT), applying custom colour corrections.

  • Parameters:
    • LUT Size: usually 16 or 32.
    • Contrast / Saturation: basic adjustments of contrast and colour intensity.
    • Temperature / Tint: moves the colours towards warm or cool tones, or towards green or magenta.

4. Channel Packing

Speeds things up by packing up to 4 single-channel (greyscale) textures into the R, G, B and A channels of a new texture.

  • Typical use: pack a Metallic map (R), Roughness (G), Ambient Occlusion (B) and Alpha/Displacement (A) into a single “ORM” texture, to save sampler calls in the material shaders.

5. Channel Unpacking

The other way round from Channel Packing: it takes an RGBA texture and splits its channels, saving each one as a greyscale texture.

6. Swapping

Lets you reorder, invert or overwrite the channels of a texture. You can copy the red channel into the alpha channel, for example, invert the green channel (handy to turn a DirectX normal map into an OpenGL one) or fill a channel with a fixed value (Zero, One, Half).

7. Blending

Combines up to 4 different textures by layering them on top of each other.

  • Blend methods: Normal, Multiply, Screen, Overlay, Add, Subtract, Min, Max.
  • Every layer has a slider for its opacity, from 0.0 to 1.0.

8. Curvature

Works out the concave areas (valleys) and convex ones (ridges) from a heightmap or a normal map. Very useful for wear masks on the edges of 3D models.

9. Cavity

Like curvature, but it works out a more marked cavity or convexity map (with a thresholded gaussian blur) to bring out small cracks and micro-detail on the surface.

10. H→2N (Height to Normal)

Turns a heightmap or a greyscale texture into a detailed normal map.

  • Algorithms: Sobel (recommended for soft, balanced detail) or Finite Differences (sharper).
  • Parameters:
    • Strength: how deep the relief of the normal map is.
    • Pre-Blur / Post-Blur: a gaussian blur applied to the input height or to the normal map that comes out, useful for taking high-frequency noise away.
    • Wrap (Seamless): when it is on, the gradients at the edges wrap the coordinates around, so the normal map keeps tiling perfectly.

11. Disp→Height (displacement normaliser)

Takes a displacement map and normalises its values back into a consistent [0, 1] range.

  • Normalisation modes:
    • MinMax: remaps the pixels according to the lowest and highest value found in the image.
    • StdDev: normalises using the standard deviation.
    • Custom: remaps the pixels by setting the lowest and highest value by hand.

12. Patterns (geometric pattern generator)

Generates repeatable structural patterns straight in memory.

  • Pattern types: Voronoi, Bricks, Hex (hexagons), Weave.
  • Parameters: Distortion (warping through noise), Edge Profile (how soft the edges are), Scale.

B. The quick preview window (context menu)

If you want to convert or pull maps out of an asset you already have, without setting up the main window:

  1. Right-click any 2D texture in the Content Browser.
  2. In the context menu, pick UETextureGen.
  3. Choose the quick operation you want: Generate Normal Map, Generate AO Map, Generate Roughness Map or Generate Displacement Map.
  4. An interactive popup opens (STexturePreviewWindow), where you set the main parameters with sliders and see the preview straight away.
  5. Name the asset in the text field and click Save to save it straight into the Content Browser.

Export and save notes (workflow)

When you save a texture, from the main window or from the quick preview:

  • Save Path: by default the textures are created in /Game/Textures. You can change that by typing the directory you want (for example /Game/MyProject/Materials/ProceduralMaps). If the folders do not exist, the Editor creates them.
  • sRGB set for you: the plugin sets sRGB to follow the PBR rendering standards of Unreal Engine:
    • Off (sRGB = false) for: normal maps, AO maps, roughness, displacement, curvature and cavity. That makes Unreal read the pixel data linearly.
    • On (sRGB = true) for: base colours (albedo), colour grading LUTs and colour patterns.
  • Exporting to disk: the main window can also write the heightmaps it makes to files outside the Unreal project, as PNG or 16-bit RAW (through the Save as PNG and Create RAW buttons), ready to import into the Landscape tool of Unreal Engine.

Code overview (C++ documentation)

The plugin is written entirely in C++ and extends the Editor interface through Slate. It holds no binary assets and no Blueprints (CanContainContent = false).

The main classes

classDiagram
    class FUETextureGenModule {
        +StartupModule()
        +ShutdownModule()
        -RegisterMenuExtensions()
    }
    class FTextureMapGenerator {
        +GenerateNormalMap()
        +GenerateAOMap()
        +GenerateRoughnessMap()
        +GenerateDisplacementMap()
        +GetTexturePixelsPublic()
        +GaussianBlur()
    }
    class FStandaloneGenerators {
        +GenerateHeightmap()
        +GeneratePerlinNoise()
        +GenerateLUT()
        +GeneratePatternPixels()
        +CreateAndSaveTexture()
    }
    class SUETextureGenToolsWindow {
        +Construct()
        -BuildTabButton()
        -TabSwitcher
    }
    class STexturePreviewWindow {
        +Construct()
        -UpdatePreview()
        -OnSaveClicked()
    }
    FUETextureGenModule --> SUETextureGenToolsWindow : Apre la finestra strumenti
    FUETextureGenModule --> STexturePreviewWindow : Apre anteprima da tasto destro
    SUETextureGenToolsWindow --> FStandaloneGenerators : Genera texture procedurale
    SUETextureGenToolsWindow --> FTextureMapGenerator : Elabora canali e filtri
    STexturePreviewWindow --> FTextureMapGenerator : Genera mappe da texture

1. FUETextureGenModule

Handles the life of the plugin. At startup (StartupModule) it loads the Slate styles (the plugin icons in Resources/) and registers the context menu extensions of the Editor through UToolMenus.

2. FTextureMapGenerator

Holds the maths and the image processing algorithms. It works by pulling the pixels of an existing texture into a linear TArray<FColor> array in memory.

  • Tiling (seamless): it uses the internal SamplePixelWrap function, which samples the pixels past the edges (coordinates modulo width/height), so maps repeat perfectly.
  • Pixel extraction: through GetTexturePixelsPublic, the generator locks mipmap 0 of the source asset for reading (Source.LockMip) and copies its raw data into a buffer compatible with BGRA8.

3. FStandaloneGenerators

Handles textures made from scratch, with no source image.

  • Procedural noise: computed on the CPU, with mathematical implementations of Perlin Noise, Cellular, Worley and so on.
  • Hydraulic erosion: the ApplyHydraulicErosion function simulates drops of rain running down the slopes of the accumulated height, eroding the ground where it is steep and leaving sediment where it is flat.

4. The Slate interfaces (SUETextureGenToolsWindow and STexturePreviewWindow)

Built entirely with the declarative Slate framework of Unreal.

  • To keep the interface quick, the Preview function runs the algorithm on a temporary copy of the pixels, shown in an SImage widget through a transient dynamic texture updated at runtime (UpdateChannelPreview): no asset is created or saved until the user clicks Save.

Troubleshooting and limits

  • The Editor freezes for a moment: every pixel algorithm and the hydraulic erosion run on the main thread of the Editor (Game Thread), so a texture of 4096 pixels or more, or a very high number of erosion iterations (> 100), will freeze the Unreal window for a while. That is expected, because the work runs synchronously on the CPU.
  • The textures do not show in the Content Browser: the plugin uses the AssetRegistry module to tell the Editor the file was created. If a saved asset does not appear at once, right-click an empty spot in the Content Browser and choose Rescan Folder.
  • Black or empty textures: check that the source texture really has the source resource inside the project (textures imported from image files, for instance, and not virtual procedural textures of the Editor, which have no source pixels to read on the CPU).

Texture Gen

The Texture Gen page: what it does, the screenshots and where to find it.