Renderer · interface
SurfaceProjection
Texture coordinates from the world rather than from the mesh.
Explained in Hello world.
interface SurfaceProjectionimport type { SurfaceProjection } from '@driftengine/core';In depth
'planar' lays the maps across the two horizontal axes, x and z: ground whose mesh
carries flat coordinates, or none worth reading, shows its texture at scale repeats a metre.
'triplanar' reads each map on the three planes across x, y and z and blends them by
how squarely the surface faces each, the normal's components raised to sharpness, so walls and
rock wear a texture without stretching. See worldUv.ts for the normal map's blend.
What it gives up: the world's coordinates do not move with a mesh, so a moving mesh slides
under its texture; triplanar reads every map three times; and the material's uScale, vScale
and offsets, which are the mesh's coordinates', do not apply.
Properties
| Name | Type | Description |
|---|---|---|
kindreadonly | 'planar' | 'triplanar' | |
scalereadonly | number | Repeats a metre: 2 lays a texture every half metre. |
sharpnessreadonlyoptional | number | How sharply triplanar's planes meet: the exponent on the normal. 4 unless given. |