normalFromHeight
normalFromHeight(
heightTex,uv,strength?,texelSize?):Node<"vec3">
Defined in: packages/nodes/src/lighting/normalFromHeight.ts:20
Generate a normal map from a heightmap texture. Uses Sobel-like sampling to compute surface normals from grayscale height data.
Parameters
Section titled “Parameters”heightTex
Section titled “heightTex”Heightmap texture (grayscale, white = high, black = low)
Node <"vec2">
UV coordinates to sample
strength?
Section titled “strength?”FloatInput = 1
Normal strength multiplier (default: 1)
texelSize?
Section titled “texelSize?”Size of one texel in UV space, or calculated from texture dimensions
Returns
Section titled “Returns”Node <"vec3">
Normal vector in tangent space (vec3, -1 to 1 range)
Example
Section titled “Example”// Generate normals from heightmapconst normals = normalFromHeight(heightmap, spriteUV, 2.0)