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.
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:
(position.x, position.z) as coordinates.(position.x, position.y) as coordinates.(position.y, position.z) as coordinates.If we just projected all three at once, they would overlap messily. We use the Surface Normal to determine which “projector” should be visible.
0, 1, 0), we use the Y projection.1, 0, 0), we use the X projection.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;