UV Projections

On a Mesh

mesh.computeUVs()              // box projection (default)
mesh.computeUVs('planar')      // Y-down onto XZ plane
mesh.computeUVs('cylindrical')
mesh.computeUVs('spherical')

Standalone

Operates on a THREE.BufferGeometry directly (mutates in place):

import { projectUVs } from 'shapecraft'

projectUVs(geometry, 'box')

Projection modes

ModeDescription
boxTri-planar — picks projection axis per vertex based on normal
planarProjects from Y axis down. u = x, v = z (normalized to bounding box)
cylindricalu = atan2(z, x), v = y (normalized)
sphericalu = atan2(z, x), v = acos(y/r)
shapecraft