2D LIGHTING & SHADER TOOLKIT
Normal Map Generator
Generate OpenGL (Y+) and DirectX (Y-) tangent-space normal maps from 2D sprites, pixel art sheets, and game tilesets.
- Free PNG export
- No sign-up
- 100% in-browser processing
What is a normal map generator? A normal map generator converts a 2D sprite or tile texture into an RGB tangent-space vector map (neutral flat #8080FF / RGB 128, 128, 255) where Red encodes horizontal X slope, Green encodes vertical Y slope, and Blue encodes forward Z depth so game engines like Godot, Unity, Unreal, and Phaser can cast real-time 2D point lights and rim highlights across flat artwork.
Scope: Infers height from pixel luminance + alpha-silhouette bevel distance locally in your browser; for multi-angle baked high-poly 3D sculpts, bake directly from geometry in Blender or Substance.
01 Sprite Source & Kernel
Tangent Normal Map & Real-Time 2D Torch Preview
Loaded Pixel Knight (64 × 64 px) · OpenGL Y+ · Move cursor over the right viewport to aim the point light.
2D GAME ENGINE IMPORT MATRIX
OpenGL vs. DirectX Normal Map Settings Across 2D Game Engines
Choosing the wrong Green-channel swizzle flips top-lit highlights onto the underside of helmets and platforms. Match your exported PNG settings against your target 2D renderer below:
| Game Engine / Renderer | Y-Axis Convention | Flat Neutral RGB / Hex | 2D Material / Texture Node | Edge Dilation | Required Texture Import Setting |
|---|---|---|---|---|---|
| Godot 4.x (2D Forward+ / Compatibility) | OpenGL (Y+ Up) | 128, 128, 255 (#8080FF) | CanvasTexture → normal_texture |
2 px (#8080FF bg) | Filter = Nearest (pixel art); Compress Mode = Lossless |
| Unity 2D URP (Light2D) | OpenGL (Y+ Up) | 128, 128, 255 (#8080FF) | Sprite-Lit-Default Secondary Texture _NormalMap |
2–3 px | Texture Type = Normal map (uncheck Create from Grayscale), Point Filter |
| Unreal Engine 5 (Paper2D / PaperZD) | DirectX (Y- Down) | 128, 128, 255 (#8080FF) | MaskedLitSpriteMaterial Additional Texture Slot 0 |
2–4 px | Compression = Normalmap (BC5) or UserInterface2D for crisp pixels, sRGB = Off |
| Phaser 3 (Light2D Pipeline) | OpenGL (Y+ Up) | 128, 128, 255 (#8080FF) | this.load.image('hero', ['hero.png', 'hero_n.png']) |
2 px | pixelArt: true in game config; enable .setPipeline('Light2D') |
| Three.js / PixiJS Custom Shader | OpenGL (Y+ Up) | 128, 128, 255 (#8080FF) | MeshStandardMaterial.normalMap |
1–2 px | normalMap.colorSpace = THREE.NoColorSpace (linear data, never sRGB) |
| GameMaker (2D Custom HLSL Shader) | DirectX (Y- Down) | 128, 128, 255 (#8080FF) | texture_set_stage(u_sNormal, spr_norm) |
2 px | Place on Separate Texture Page so atlas packing does not bleed neighbor frames |
Reproducible Pixel-Sprite Benchmark
Measured locally in Chromium on standard 2D sprite assets with Scharr 3×3 gradient strength 2.4, Alpha Silhouette Dome 55%, and 2 px edge dilation:
Asset 1: Pixel Knight (64 x 64 px, 1,492 opaque px) -> Compute: 1.9 ms | Output PNG: 4.8 KB | Halo bleed @ 2x zoom: 0 px
Asset 2: Slime 4-Frame Strip (128 x 32 px, 4 poses) -> Compute: 2.0 ms | Output PNG: 5.1 KB | Frame gutter spill: 0 px
Asset 3: Dungeon Brick Tile (64 x 64 px, opaque) -> Compute: 1.6 ms | Output PNG: 7.4 KB | Mortar seam Z-normal: 0.74
2D PIXEL ART LIGHTING WORKFLOW
Why Standard 3D Normal Filters Fail on Pixel Art—and How Silhouette Beveling Fixes It
Traditional photograph-to-normal tools were built for noisy concrete, bark, and fabric textures. They pass a 3×3 Sobel or Scharr derivative filter over grayscale luminance: wherever brightness changes from pixel to pixel, the filter tilts the normal vector. On hand-pixelled 16×16 or 64×64 game characters, however, an entire tunic, shield face, or slime body is painted with solid flat palette swatches. A pure derivative filter outputs [128, 128, 255] across the entire interior and spikes violently along 1-pixel black outlines, making the character look like embossed tin foil rather than a rounded volume.
Blending an Alpha Silhouette Distance Dome solves that flat-interior artifact. By computing each opaque pixel's Euclidean distance to the nearest transparent silhouette boundary and normalizing that profile into a smooth hemisphere ramp before adding high-frequency Scharr surface detail, the character's torso, limbs, and helmet curve naturally away from the camera near their edges. When a torch or fireball passes behind the player in Godot or Unity 2D URP, rim light wraps smoothly around the silhouette while armor rivets and belt buckles still catch crisp pixel-accurate specular glints.
Preventing Frame-Border Bleeding on Multi-Frame Sprite Sheets
When generating normal maps for an entire animation sheet—such as a 4-frame strip exported from our Sprite Sheet Maker or FNF Sparrow XML Generator—keep at least 2 px to 4 px of transparent padding between adjacent cells if you enable silhouette beveling or edge dilation. Leaving background pixels filled with neutral #8080FF (full alpha 255) is safest for Godot CanvasTexture and Phaser Light2D, because the diffuse sprite's own alpha channel already masks transparent regions in the fragment shader without risking black [0,0,0] interpolation halos.
Need higher pixel density before lighting a low-res 16×16 asset? Run your diffuse sheet through the Pixel Art Scaler at 2x or 4x first, then generate the normal map at the target resolution so bevel gradients step across multiple pixels cleanly.
FREQUENTLY ASKED QUESTIONS
2D Sprite Normal Map Generator FAQ
Should I choose OpenGL (Y+) or DirectX (Y-) for Godot and Unity 2D sprites?
Use OpenGL (Y+) for Godot 4, Unity 2D URP, Blender, Phaser 3, PixiJS, and Three.js—where brighter green values point toward the top of the sprite. Switch to DirectX (Y-) for Unreal Engine Paper2D and native Direct3D HLSL pipelines where the V texture coordinate runs top-to-bottom.
Why do pixel art sprites look like flat cardboard with standard Sobel normal filters?
Sobel and Scharr filters only measure brightness differences between neighboring pixels, so flat palette regions stay dead-flat at RGB 128, 128, 255. Raising the Alpha Silhouette Dome Bevel slider adds rounded 3D volume from the sprite's transparent outline inward, giving torches and explosions realistic wrap-around lighting.
What does RGB [128, 128, 255] (#8080FF) mean in a tangent-space normal map?
Surface unit vectors range from -1.0 to +1.0 on X, Y, and Z, mapped linearly into 8-bit 0..255 color channels via channel = round((v * 0.5 + 0.5) * 255). A flat sprite pixel pointing straight out of the screen has vector (0, 0, +1), which encodes to R=128, G=128, B=255 (#8080FF).
Why should I keep sRGB turned off when importing normal maps in Unity, Godot, or Three.js?
Normal maps store raw math vectors, not perceptual colors. If the engine applies an sRGB gamma curve (2.2) on load, midtone 128 channels decode near 0.21 instead of 0.50, tilting every flat normal diagonally and breaking light directionality. Always mark normal textures as Linear / Non-Color Data.
Why does Alpha Edge Dilation matter on transparent sprites?
When you clip alpha or use bilinear/mipmap sampling on scaled sprites, the GPU averages edge pixels with neighboring transparent pixels. Filling outer pixels with neutral #8080FF or 2 px dilated edge normals prevents dark shadow rings around character silhouettes.
Does this tool upload my unpublished game sprites?
No. Every calculation—from Scharr convolution and silhouette distance beveling to dynamic 2D lighting and PNG export—runs locally inside your browser tab.
CONNECTED SPRITE PIPELINE