Zero-Boilerplate Shader Builder

Three.js, Godot 4 & GLSL PBR Material Snippet Generator

Configure normal map scale, OpenGL vs DirectX Y-handedness, roughness, metalness, and UV repeat tiling—then copy clean, color-space-correct Three.js, Godot 4, or GLSL normal shader code in one click.

100% Local Browser Engine · 0 Bytes Uploaded
Instant Deterministic Output
import * as THREE from "three";

const loader = new THREE.TextureLoader();
const repeat = 2;
const setup = (tex: THREE.Texture, isColor = false) => {
  tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
  tex.repeat.set(repeat, repeat);
  tex.colorSpace = isColor ? THREE.SRGBColorSpace : THREE.NoColorSpace;
  return tex;
};

export const weatheredbrickMaterial = new THREE.MeshStandardMaterial({
  map: setup(loader.load("/textures/weatheredbrick_albedo.png"), true),
  normalMap: setup(loader.load("/textures/weatheredbrick_normal.png")),
  normalScale: new THREE.Vector2(1, 1),
  roughnessMap: setup(loader.load("/textures/weatheredbrick_roughness.png")),
  aoMap: setup(loader.load("/textures/weatheredbrick_ao.png")),
  roughness: 0.65,
  metalness: 0,
});

Color-space & normal-scale conventions embedded in generated snippets

Target RuntimeAlbedo Color SpaceNormal Color SpaceDirectX Fix
Three.js (r152+)THREE.SRGBColorSpaceTHREE.NoColorSpacenormalScale.y = -scale
Godot 4 (.tres)sRGB (default)Linear NormalFlip Green prior to import
Custom GLSLsRGB -> LinearLinear Unpack (2n-1)n.y = -n.y in shader

Preventing Three.js r152+ color-space and DirectX normal mistakes

Since Three.js r152 replaced encoding with colorSpace, forgetting THREE.SRGBColorSpace on albedo textures or accidentally applying sRGB to normal maps washes out materials instantly. And if your normal map came from Unreal or Substance (DirectX -Y), negating normalScale.y fixes lighting direction immediately.

From local PBR export straight to working browser 3D scenes

Generate your synchronized Albedo, Normal, Roughness, and AO maps in Normal Map Studio, then paste this generated material loader directly into your Three.js, React Three Fiber, or Godot 4 project.

Frequently asked questions

How do I use a DirectX (-Y) normal map in Three.js without re-exporting?

Pass a negative Y component to normalScale: new THREE.Vector2(1, -1). Our generator applies this automatically when DirectX is selected.

Why does Three.js require THREE.NoColorSpace on normal and roughness maps?

Normal, roughness, metallic, and AO maps hold linear mathematical vectors/scalars; applying sRGB gamma bends normals and makes surfaces look glossy.

Does Three.js aoMap require a second UV set?

In recent Three.js versions aoMap defaults to uv1 (or uv0 if channel=0 is set); verify your geometry attributes if AO looks missing.

Are the generated snippets free for commercial games and web apps?

Yes—copy and modify them freely in any personal or commercial project.

More free local PBR & normal map tools