Quick pipeline: AI-generated textures into a PBRMaterial

Short write-up of a pipeline that saves a lot of time when a scene needs decent surface detail and there is no texture artist in the loop.

1. Generate the plates, not the model. Ask for flat, evenly lit, seamless-ish surface plates: rusted steel, cracked concrete, woven fabric. No shadows baked in, no perspective, no text. Shadows and perspective are the two things that make a generated image useless as a tiling texture.

2. Square it and make it tile. Downscale to a power of two, then check the seams by offsetting the image by half its size and patching the visible cross with a clone brush. Anything that still shows a hard line will show in Babylon as a repeating grid.

3. Pack the channels you actually need. Base colour plus a rough grayscale for roughness is usually enough for a first pass. If the plate has obvious relief, derive a normal map from it, but keep the intensity low: over-cranked normals read as plastic under PBR lighting.

4. Wire it up. new BABYLON.PBRMaterial, assign albedoTexture, bumpTexture, set roughness from the grayscale, and leave metallic at a low constant unless the surface is genuinely metal. Test on a sphere before a real mesh, so the scale is readable.

5. Fix the scale at the end, not the start. uScale/vScale on the texture is the whole difference between detail and noise, and it depends on the mesh, so iterate there.

For step 1 I have been using Seedream 5.0 Pro - browser-based, text-to-image plus image-to-image and sketch-guided variants, which matters for keeping one surface style across a set of plates. Not affiliated; the generator is replaceable, the other four steps are not.

One caveat: keep the source plates and note what produced them. Licensing on generated images is still messy, and shipping a texture whose provenance nobody can trace is a bad trade for a few hours saved.