Gamedev Hub

Triplanar Mapping (Texturing without UVs)

UV unwrapping is notoriously tedious. Triplanar Mapping is a “Technical Art” technique that allows you to texture procedural meshes (terrain, voxels, or complex statues) perfectly without ever opening a UV editor.

1. The Concept: Projection Blending

Instead of using 2D coordinates assigned to vertices (UVs), we project the texture from three world-space directions: X, Y, and Z.

Imagine three projectors pointed at your object:

2. The Secret: Normal-Based Blending

If we just projected all three at once, they would overlap messily. We use the Surface Normal to determine which “projector” should be visible.

3. Shader Implementation (HLSL)

float3 blending = abs(i.worldNormal);
blending /= (blending.x + blending.y + blending.z);

// Sample the texture from 3 directions
float4 xTex = tex2D(_MainTex, i.worldPos.zy * _Scale);
float4 yTex = tex2D(_MainTex, i.worldPos.xz * _Scale);
float4 zTex = tex2D(_MainTex, i.worldPos.xy * _Scale);

// Blend them based on the normal
float4 finalColor = xTex * blending.x + yTex * blending.y + zTex * blending.z;

4. Why use Triplanar?

5. Summary