The3DG

Nature · Test cube 12

Wood grain

Wavy growth rings with a fine grain on top.

Presented by FloNothing in nature repeats exactly. Neither do these. Relax into it.
× 1.00
0.8 mm
135°
  • Too fine for a 0.4 mm nozzle: the narrowest part is about 1.0 mm (under 1.2 mm). Make it bigger.

25 mm, with your size and depth. Prints upright, no supports. About 4 MB.

Good for

Wood-filled filament, boxes, frames, handles.

Print notes

The fine grain is smaller than the nozzle and mostly prints as a soft roughness; the rings do the work. Pairs well with wood-filled filament.

  • Depth 0.4 to 1.5 mm for a 0.4 mm nozzle (as written: 0.8 mm).
  • Best on walls, printed upright. On a flat top, use thin layers (0.12 mm or less).
  • Fade it out over the bottom 3 mm so the first layers are flat and stick to the plate.
  • Not printed yet: these notes come from the geometry. The test cube will tell us more.

The formula

The real code this page runs: give it a point (U mm across, V mm up) and it returns the height there, in mm. Push the surface out by that much and the texture is real geometry.

function woodGrain(U: number, V: number, amp = 0.6) {
  const w = U + 6 * noise(U / 18, V / 40) + 2 * noise(U / 5, V / 9);
  const rings = Math.abs(Math.sin(w / 2.2)) ** 0.5;
  return amp * (rings + 0.3 * noise(U / 2, V / 0.6));
}
The helpers it uses (noise, rnd)
/** Smooth value noise. */
function noise(x: number, y: number) {
  const xi = Math.floor(x);
  const yi = Math.floor(y);
  const xf = x - xi;
  const yf = y - yi;
  const u = xf * xf * (3 - 2 * xf);
  const v = yf * yf * (3 - 2 * yf);
  const a = rnd(xi, yi);
  const b = rnd(xi + 1, yi);
  const c = rnd(xi, yi + 1);
  const d = rnd(xi + 1, yi + 1);
  return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
}
/** A repeatable random number 0..1 for a cell (no Math.random: the same texture every time). */
function rnd(a: number, b: number, k = 0) {
  const x = Math.sin(a * 127.1 + b * 311.7 + k * 74.7) * 43758.5453;
  return x - Math.floor(x);
}

Printed

Test cube 12 is waiting for the printer. Its photo goes here.