Pick a single view to take the texture apart: noise → masks → final color. Drag to rotate, wheel to zoom.
Theory: Value Noise
hash(p) -> pseudo-random number in [0,1) per lattice point
noise(p) -> trilinear blend of the 8 surrounding hashes
with smooth weights s = f·f·(3 - 2f)
Sampled at the 3D surface point, not at UV, so the texture
has no seam where u wraps from 1 back to 0.
Theory: fbm (fractal noise)
fbm(p) = Σ amp_i · noise(2^i · p), amp_i = 0.5^(i+1)
Each octave doubles the frequency and halves the strength.
Used for dough speckles, icing tint and bump height.
Theory: Icing Mask & Drips
g(u) = 0.5 + 0.25·sin(2π·3u) + 0.15·sin(2π·7u+1.3)
+ 0.1·sin(2π·13u+4)
edge(u) = 0.35 - 0.7·g(u)
mask = smoothstep(edge-0.03, edge+0.03, sin(2πv))
sin(2πv) is the height on the tube (1 = top). Integer sine
frequencies keep the edge periodic in u. Where edge is low the
icing drips further down the side.
Theory: Layers & Sprinkles
albedo = mix(dough, icing, mask)
albedo = mix(albedo, chocolate, stripe · mask)
Sprinkles: split UV into a 60x24 grid, hash each cell,
10% of cells get a rotated capsule with a hashed color.
Chocolate: stripe = smoothstep(0.8,0.88, 0.5+0.5·sin(2πw))
w = 14u + 1.5·sin(4πv) + 1.2·fbm(p)
Theory: Displacement (vertex shader)
P' = P + N · thickness · mask · (0.6 + 0.4·fbm)
Icing physically sits above the dough. The normal is left
unchanged for simplicity, so the bump shading below
supplies the detail.
Theory: Bump Mapping
Height h(p) comes from noise. Its screen-space slope:
dh/dx = dFdx(h), dh/dy = dFdy(h)
N' = normalize( |det|·N - sign(det)·(dh/dx·r1 + dh/dy·r2) )
r1 = cross(dFdy(P), N), r2 = cross(N, dFdx(P))
Derivatives replace a stored normal map or tangents.