# AI Texture Generator for Games: Seamless PBR Materials Step by Step

How to turn an AI texture into a full PBR material for Unity, Godot or Unreal, the maps you need, and when a scanned CC0 texture is the better pick.

_Last updated: 2026-11-27_

An AI texture generator gives you one picture: a base colour. A game material needs more than that. To get a seamless PBR material that reacts to light in Unity, Godot or Unreal, you generate a tileable base colour with seamless tiling turned on, derive a height, a normal and a roughness map from it, pack the maps the way your engine expects, and check the result on a lit 3D shape before it goes into a level. This post walks through that pipeline, the settings that matter, and when you should skip AI and download a scanned material instead.

## What a PBR Material Actually Needs

Physically based rendering describes a surface with a few maps. Each one answers a different question about the surface, and only the first one is a "picture":

- Base colour (albedo): the colour of the surface with no lighting in it. No shadows, no highlights, no ambient occlusion baked in.
- Normal: the small bumps and grooves that catch light, stored as a direction per pixel. This is what makes bricks look like bricks at a grazing angle.
- Roughness (or smoothness in Unity): how blurry or sharp the reflections are. Wet stone is smooth, dry stone is rough.
- Metallic: whether the surface is a metal. For most game surfaces this is simply 0, and for a pure metal 1; values in between are rare.
- Height (displacement): how high each point is. Used for parallax, tessellation, terrain blending, and as the source for the normal map.
- Ambient occlusion: how much light reaches the cracks. Optional, often packed into another texture.

Two rules break most first attempts. The base colour is stored as sRGB colour, while normal, roughness, metallic, height and AO are data and must be imported as linear (sRGB off). And the base colour must not contain lighting: if the AI painted a strong shadow on one side of every stone, every tile of your floor will be lit from the same fake sun, no matter where your real lights are.

## Step 1: Generate a Seamless Base Colour with an AI Texture Generator

A tileable texture repeats without a visible seam. You can fix seams afterwards with offset-and-clone tricks, but it is far easier to generate the texture seamless from the start. Diffusion models can do this by treating the image as if it wraps around at the edges; in stable-diffusion.cpp this is the circular mode.

In AI Game Developer this is built into local image generation. The agent's image tool has a tileable option for textures that repeat (walls, floors, terrain, fabric), and the local models run on your own GPU through stable-diffusion.cpp. You ask in plain words, for example "a seamless top-down cobblestone texture, hand-painted, even flat lighting", and the agent turns tiling on, generates the image, saves it into the project and imports it into the connected Unity, Godot or Unreal editor. The full walkthrough of local generation is in ai-game.dev/blog/local-ai-image-generation-for-games.

When you want to explore the look by hand before committing, compare models and seeds in Asset Studio, the generation tab of the app (ai-game.dev/blog/ai-asset-generation-asset-studio). Keep a fixed seed once a texture is close, and change one line of the prompt at a time.

Prompts for base colour textures follow different rules from concept art. In our experience these words help:

- "top-down" or "orthographic, viewed straight on": no perspective, so the texture tiles on a flat surface.
- "even, flat, diffuse lighting, no shadows": keeps the lighting out of the albedo.
- The scale, in real terms: "stones about 20 cm across" or "fine sand grains". Scale is the thing you notice first when it tiles wrong.
- The style once, at the end: "hand-painted", "photographic", "stylised low-saturation".
- What to keep out, as a negative prompt: "perspective, vignette, text, border, strong shadows, single large object".

Avoid one big feature in the middle of a texture: a lone crack, a single large rock or a puddle. It tiles seamlessly, but on a large floor the eye picks out the same rock every two metres. Many small features of similar size repeat much better.

## Step 2: Derive Height, Normal and Roughness Maps

Our pipeline derives the other maps from the base colour. It is fast, it stays in the project, and for stylised and mid-distance surfaces it works well. It is also an approximation, and it is worth knowing exactly where.

The usual chain looks like this:

1. Height from luminance: convert the base colour to greyscale and treat bright as high. Blur it slightly so the colour noise does not turn into bumps. Adjust contrast until the gaps between stones are the darkest part.
2. Normal from height: take the slope of the height map in X and Y, and store it as a direction. A strength factor controls how deep the bumps look. Sample across the edges with wrap-around, or the normal map gets a seam even though the colour did not.
3. Roughness from height and colour: start from a mid grey (around 0.6 to 0.8 for stone, soil and wood), make cracks rougher and raised, worn parts slightly smoother. Keep the range narrow; a roughness map with full black and full white is almost always wrong.
4. Metallic: a flat 0 for non-metals. Do not derive metallic from colour.

You do not need a separate tool for this. In AI Game Developer the agent writes a short script and runs it right inside the live editor through code execution, C# in Unity or Python in Unreal, and saves the maps next to the base colour. Here is the core of a normal-from-height pass in Unity C#, the kind of code the agent writes and runs in one step:

```csharp
// height: a readable greyscale Texture2D, same size as the base colour.
// strength: 2-8 for stylised surfaces, higher for deep grooves.
static Texture2D NormalFromHeight(Texture2D height, float strength)
{
    int w = height.width, h = height.height;
    var src = height.GetPixels();
    var dst = new Color[src.Length];
    float H(int x, int y) => src[((y + h) % h) * w + ((x + w) % w)].grayscale; // wraps: seamless

    for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++)
    {
        float dx = (H(x + 1, y) - H(x - 1, y)) * 0.5f;
        float dy = (H(x, y + 1) - H(x, y - 1)) * 0.5f;
        var n = new Vector3(-dx * strength, -dy * strength, 1f).normalized; // OpenGL (Y+)
        dst[y * w + x] = new Color(n.x * 0.5f + 0.5f, n.y * 0.5f + 0.5f, n.z * 0.5f + 0.5f, 1f);
    }

    var result = new Texture2D(w, h, TextureFormat.RGBA32, false, true); // linear
    result.SetPixels(dst);
    result.Apply();
    return result;
}
```

The honest limit: brightness is not height. A dark stain reads as a hole, a bright painted line reads as a ridge, and a texture with lighting baked in gives normals that copy the fake shadows. This is why Step 1 asks for flat lighting. For hero surfaces the player sees up close, a scanned material or a dedicated tool gives better depth than any single-image guess.

## Step 3: Pack and Import the Maps for Your Engine

Every engine wants the same information in a slightly different shape. Get these right once, write them into your project's conventions, and the agent can follow them every time.

Normal map direction:

- Unity and Godot use the OpenGL convention (green up, Y+).
- Unreal uses the DirectX convention (green down, Y-). Flip the green channel, or bumps look like dents.
- Many libraries ship both. Poly Haven, for example, offers a Normal (GL) and a Normal (DX) map for each texture.

Channel packing:

- Unity URP Lit and the Standard shader: metallic in the red channel and smoothness (1 minus roughness) in the alpha channel of one texture. Set the normal map's Texture Type to Normal map.
- Unity HDRP Lit: the mask map holds metallic in red, ambient occlusion in green, a detail mask in blue and smoothness in alpha.
- Unreal: the common packing is ORM, occlusion in red, roughness in green, metallic in blue, with sRGB turned off on the texture.
- Godot: StandardMaterial3D lets you pick which channel each map reads from, and ORMMaterial3D takes a packed ORM texture directly.

Import settings to check in any engine:

- Base colour: sRGB on. Every other map: sRGB off (linear).
- Wrap mode: repeat. A clamped seamless texture is not seamless.
- Mipmaps on, and anisotropic filtering for floors and roads seen at a low angle.
- Resolution: 1024 is enough for most tiling surfaces in a mid-size game; spend 2048 and above on the few surfaces the camera lingers on.

## Step 4: Check the Material Before It Goes into a Level

A texture that looks great as a flat square can fall apart on a lit, curved surface: the normal map is inverted, the roughness is too shiny, or the tiling shows a pattern at x4. Check all three before you build a level out of it.

The material preview in the AI Game Developer app is made for this. Open any texture of the set and press Show as a material: the app collects the rest of the set from the same folder by name (BaseColor, Normal, Roughness, Metallic, AO, or a packed ARM map) and renders it on a sphere, cube, torus or plane under a studio, sky or sunset environment. It also opens Unity .mat files and Godot .tres materials directly, with their textures. The tiling control goes from x1 to x8, which is the fastest way to see repetition: if one feature jumps out at x4, it will jump out on your floor. Details are in ai-game.dev/blog/material-preview-unity-godot-materials-in-3d.

A quick checklist for every new material:

- Rotate the light around the shape: do the bumps stay bumps, or turn into dents on one side? If dents, flip green.
- Look at a grazing angle: is the surface too glossy? Raise roughness.
- Tile it x4 and x8: any obvious repeat? Regenerate with smaller, more uniform features.
- Look at the seams of the plane: any line? Check the wrap mode and the normal pass.
- Compare it next to an existing material of the game: same brightness range and saturation?

## When to Use AI, Scans or Substance 3D Sampler

AI generation is one of three good sources of PBR materials, and each wins in a different place. Our recommendation:

If you need a stylised or one-of-a-kind surface that fits your art direction, generate it. AI is strongest for hand-painted ground, fantasy walls, alien rock, fabric patterns and anything that has to match a specific look. You can make twenty variants of a floor in the time it takes to search a library for one.

If you need realistic, physically accurate materials, start from scans. Poly Haven (https://polyhaven.com) publishes its textures under CC0: as of November 2026, its licence page says you can use them for any purpose, including commercial games, with no credit required. A texture page there offers 1K to 8K downloads with separate maps: diffuse, Normal (GL), Normal (DX), roughness, displacement, AO and a packed AO/Rough/Metal (ARM) map, as JPG, PNG or EXR. Scanned height is real height, which is exactly what single-image derivation cannot give you.

If you need to turn your own photos into materials, or want the best derivation from a single image, use Adobe Substance 3D Sampler. Its Image to Material feature removes shadows and generates albedo, roughness, normal and displacement maps, and it has tiling tools for making a capture seamless. As of November 2026, Adobe includes Sampler in the Substance 3D Texturing plan, the cheapest plan that has it, and in the larger Substance 3D Collection plan (US$59.99 per month for individuals), with a free trial.

The trade-offs in short:

- AI generation: any style, unlimited variants, fast iteration. Weaker: derived maps are approximate, and realism up close lags behind scans.
- Poly Haven scans: real height and roughness, free, CC0. Weaker: realistic look only, limited to what has been scanned, the same textures appear in many other games.
- Substance 3D Sampler: the strongest single-image to material tool and full manual control. Weaker: a paid subscription, and you still need a source image.

Mixing them works well. A split that works well: scanned materials for the realistic base layer, AI-generated variants for the stylised and story-specific surfaces, and a derived normal pass on both when the art direction needs softer detail.

## Make PBR Materials with AI Game Developer

The whole pipeline runs in one place in AI Game Developer. Ask the agent for a seamless texture, let it derive the normal, roughness and height maps with a script in your editor, pack them for Unity, Godot or Unreal, and check the result in the material preview next to the chat. When you want to choose between looks by hand, open Asset Studio and compare models and seeds yourself.

Download the app at ai-game.dev/download, connect your project, and start with one surface you need this week: a floor, a wall or a patch of ground. One good material that tiles well teaches you more about the pipeline than any list of settings.

## Related

- Local AI image generation for games: https://ai-game.dev/blog/local-ai-image-generation-for-games
- Material Preview for Unity and Godot: https://ai-game.dev/blog/material-preview-unity-godot-materials-in-3d
- Asset Studio for AI asset generation: https://ai-game.dev/blog/ai-asset-generation-asset-studio
- Download the app: https://ai-game.dev/download
- AI Game Developer for Unity: https://ai-game.dev/engines/unity

---

Source (HTML): https://ai-game.dev/blog/ai-texture-generator-pbr-materials
