Three.js Procedural Animated Textures Gallery

Six fully procedural animated materials in Three.js (Voronoi cells, lava flow, marble, wood, plasma and electric arcs) evaluated per pixel in object space, with no image textures.

Key topics: three.js procedural texture, voronoi shader, lava shader, marble, plasma, noise shader

What this code does

- Object-Space Noise: patterns use the mesh's local position, so there are no UV seams and rotation keeps them attached.
- Animated Voronoi: feature points orbit inside their cells, and F2 − F1 marks the borders.
- Flow Noise: lava warps its own noise domain over time and thresholds it into cooled crust and glowing cracks.
- Marble & Wood: sine stripes and rings perturbed by fBm give veins and grain.
- Plasma & Arcs: summed sines through a cosine palette, and thin bright ridges where noise crosses 0.5.
- Controls: focus one material, animation speed, pattern scale and spin.

Continue Learning

JavaScript Implementation

ES6+
// Animated 3D Voronoi cells evaluated per pixel in object space
const voronoiGLSL = `
  float hash (vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }
  vec2 voronoi (vec3 p, float t) {
    vec3 i = floor(p), f = fract(p);
    float f1 = 8.0, f2 = 8.0;
    for (int z = -1; z <= 1; z++) for (int y = -1; y <= 1; y++) for (int x = -1; x <= 1; x++) {
      vec3 g = vec3(x, y, z);
      vec3 o = 0.5 + 0.45 * sin(t + 6.2831 * vec3(hash(i + g), hash(i + g + 17.0), hash(i + g + 31.0)));
      float d = length(g + o - f);
      if (d < f1) { f2 = f1; f1 = d; } else if (d < f2) f2 = d;
    }
    return vec2(f1, f2); // F2 − F1 ≈ 0 on cell borders
  }`