Codels
607 tris0.84 × 1.25 × 0.65 m

Use it in code

Remix in the editor
Self-contained ES module — only depends on three. Call the factory and add the group to your scene.
/**
 * Shovel — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 607 · Size (W × H × D): 0.84 × 1.25 × 0.65 m
 *
 * Usage:
 *   import { createShovel } from './shovel.js';
 *   
 *   const model = createShovel();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// Deterministic vertex displacement (organic low-poly look).
function jitter(geometry, amount, seed) {
  const pos = geometry.attributes.position;
  const h = (a, b, c, s) => {
    let x = Math.imul(a, 73856093) ^ Math.imul(b, 19349663) ^ Math.imul(c, 83492791) ^ Math.imul(s, 2654435761);
    x = Math.imul(x ^ (x >>> 16), 2246822507);
    x = Math.imul(x ^ (x >>> 13), 3266489909);
    return ((x ^ (x >>> 16)) >>> 0) / 4294967295 - 0.5;
  };
  for (let i = 0; i < pos.count; i++) {
    const x = pos.getX(i), y = pos.getY(i), z = pos.getZ(i);
    const qx = Math.round(x * 1000), qy = Math.round(y * 1000), qz = Math.round(z * 1000);
    pos.setXYZ(i, x + h(qx, qy, qz, seed) * 2 * amount, y + h(qx, qy, qz, seed + 1) * 2 * amount, z + h(qx, qy, qz, seed + 2) * 2 * amount);
  }
  pos.needsUpdate = true;
  geometry.computeVertexNormals();
  return geometry;
}

// Extrude a 2D outline along Z (centered). bevel = [thickness, size, segments].
function extrude(outline, depth, holes = [], bevel = null) {
  const shape = new THREE.Shape(outline.map(([x, y]) => new THREE.Vector2(x, y)));
  for (const hole of holes) shape.holes.push(new THREE.Path(hole.map(([x, y]) => new THREE.Vector2(x, y))));
  const options = bevel
    ? { depth, bevelEnabled: true, bevelThickness: bevel[0], bevelSize: bevel[1], bevelSegments: bevel[2] }
    : { depth, bevelEnabled: false };
  return new THREE.ExtrudeGeometry(shape, options).translate(0, 0, -depth / 2);
}

// Tube along a smooth curve through the given points.
function tube(path, radius, tubularSegments, radialSegments, closed = false) {
  const curve = new THREE.CatmullRomCurve3(path.map(([x, y, z]) => new THREE.Vector3(x, y, z)), closed);
  return new THREE.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}

export function createShovel() {
  const root = new THREE.Group();
  root.name = 'Shovel';

  // Materials
  const bladeMat = new THREE.MeshStandardMaterial({ name: 'blade', color: 0x8b929c, roughness: 0.42, metalness: 0.4, flatShading: true });
  const socketMat = new THREE.MeshStandardMaterial({ name: 'socket', color: 0x5f636a, roughness: 0.5, metalness: 0.4, flatShading: true });
  const handleMat = new THREE.MeshStandardMaterial({ name: 'handle', color: 0xb07a45, roughness: 0.8, flatShading: true });
  const gripMat = new THREE.MeshStandardMaterial({ name: 'grip', color: 0x7b5530, roughness: 0.85, flatShading: true });
  const dirtMat = new THREE.MeshStandardMaterial({ name: 'dirt', color: 0x5e4129, roughness: 1, flatShading: true });
  const dirtDarkMat = new THREE.MeshStandardMaterial({ name: 'dirtDark', color: 0x47301c, roughness: 1, flatShading: true });
  const pebbleMat = new THREE.MeshStandardMaterial({ name: 'pebble', color: 0x8a8580, roughness: 0.9, flatShading: true });

  // Parts
  const mound = new THREE.Mesh(jitter(new THREE.SphereGeometry(0.34, 9, 4, 0, Math.PI * 2, 0, Math.PI / 2), 0.03, 7), dirtMat);
  mound.name = 'mound';
  mound.scale.set(1, 0.42, 0.85);
  root.add(mound);
  const clod = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0294, 0), 0.006, 0), pebbleMat);
  clod.name = 'clod';
  clod.position.set(0.3882, 0.012, 0.0505);
  clod.scale.set(1, 0.6, 1);
  root.add(clod);
  const clod2 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0368, 0), 0.006, 1), dirtDarkMat);
  clod2.name = 'clod';
  clod2.position.set(0.1279, 0.012, 0.2402);
  clod2.scale.set(1, 0.6, 1);
  root.add(clod2);
  const clod3 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0431, 0), 0.006, 2), pebbleMat);
  clod3.name = 'clod';
  clod3.position.set(-0.2286, 0.012, 0.2308);
  clod3.scale.set(1, 0.6, 1);
  root.add(clod3);
  const clod4 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0398, 0), 0.006, 3), dirtDarkMat);
  clod4.name = 'clod';
  clod4.position.set(-0.3844, 0.012, 0.0719);
  clod4.scale.set(1, 0.6, 1);
  root.add(clod4);
  const clod5 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0343, 0), 0.006, 4), pebbleMat);
  clod5.name = 'clod';
  clod5.position.set(-0.1161, 0.012, -0.2367);
  clod5.scale.set(1, 0.6, 1);
  root.add(clod5);
  const clod6 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0308, 0), 0.006, 5), dirtDarkMat);
  clod6.name = 'clod';
  clod6.position.set(0.1451, 0.012, -0.3238);
  clod6.scale.set(1, 0.6, 1);
  root.add(clod6);
  const shovel = new THREE.Group();
  shovel.name = 'shovel';
  shovel.position.set(0, 0.075, 0.03);
  shovel.rotation.set(deg(-10), deg(18), deg(4));
  root.add(shovel);
  const blade = new THREE.Mesh(extrude([[-0.09, 0], [0.09, 0], [0.105, 0.015], [0.105, 0.28], [-0.105, 0.28], [-0.105, 0.015]], 0.008), bladeMat);
  blade.name = 'blade';
  shovel.add(blade);
  const tread = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.016, 0.03), socketMat);
  tread.name = 'tread';
  tread.position.set(0, 0.282, -0.012);
  shovel.add(tread);
  const spine = new THREE.Mesh(new THREE.BoxGeometry(0.035, 0.168, 0.012), socketMat);
  spine.name = 'spine';
  spine.position.set(0, 0.1904, -0.01);
  shovel.add(spine);
  const socket = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.034, 0.14, 7), socketMat);
  socket.name = 'socket';
  socket.position.set(0, 0.35, -0.012);
  shovel.add(socket);
  const shaft = new THREE.Mesh(new THREE.CylinderGeometry(0.018, 0.019, 0.62, 7), handleMat);
  shaft.name = 'shaft';
  shaft.position.set(0, 0.71, -0.012);
  shovel.add(shaft);
  const dGrip = new THREE.Mesh(tube([[0, 1, -0.012], [-0.07, 1.08, -0.012], [-0.065, 1.15, -0.012], [0.065, 1.15, -0.012], [0.07, 1.08, -0.012]], 0.014, 20, 5, true), gripMat);
  dGrip.name = 'dGrip';
  shovel.add(dGrip);
  const gripBar = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 0.11, 7), handleMat);
  gripBar.name = 'gripBar';
  gripBar.position.set(0, 1.142, -0.012);
  gripBar.rotation.set(0, 0, deg(90));
  shovel.add(gripBar);

  root.traverse((o) => {
    if (o.isMesh) {
      o.castShadow = true;
      o.receiveShadow = true;
    }
  });
  return root;
}

export default createShovel;

Ratings & comments

—
No ratings yet — be the first.
5
0
4
0
3
0
2
0
1
0

Sign in to rate and comment.

0 comments

No comments yet. Share how you used this model or what could be better.

Related models

Same category or similar tags