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.
Zero-Boilerplate Shader Builder
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.
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,
});| Target Runtime | Albedo Color Space | Normal Color Space | DirectX Fix |
|---|---|---|---|
| Three.js (r152+) | THREE.SRGBColorSpace | THREE.NoColorSpace | normalScale.y = -scale |
| Godot 4 (.tres) | sRGB (default) | Linear Normal | Flip Green prior to import |
| Custom GLSL | sRGB -> Linear | Linear Unpack (2n-1) | n.y = -n.y in shader |
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.
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.
Pass a negative Y component to normalScale: new THREE.Vector2(1, -1). Our generator applies this automatically when DirectX is selected.
Normal, roughness, metallic, and AO maps hold linear mathematical vectors/scalars; applying sRGB gamma bends normals and makes surfaces look glossy.
In recent Three.js versions aoMap defaults to uv1 (or uv0 if channel=0 is set); verify your geometry attributes if AO looks missing.
Yes—copy and modify them freely in any personal or commercial project.
Optional Google Analytics
Accept loads Google Analytics 4 for traffic and conversion measurement. Reject keeps it off. Necessary first-party product events and the cookie-free pageview counter remain active. This choice never enables advertising.