734 Tris1,02 × 1,00 × 1,08 m
Im Code verwenden
Im Editor remixenwoodcutter-axe.js · 266 Zeilen
Eigenständiges ES-Modul — hängt nur von three ab. Ruf die Factory auf und füge die Gruppe deiner Szene hinzu.
/**
* Woodcutter Axe — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 734 · Size (W × H × D): 1.02 × 1.00 × 1.08 m
*
* Usage:
* import { createWoodcutterAxe } from './woodcutter-axe.js';
*
* const model = createWoodcutterAxe();
* 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 createWoodcutterAxe() {
const root = new THREE.Group();
root.name = 'WoodcutterAxe';
// Materials
const steelMat = new THREE.MeshStandardMaterial({ name: 'steel', color: 0x737a84, roughness: 0.45, metalness: 0.45, flatShading: true });
const edgeMat = new THREE.MeshStandardMaterial({ name: 'edge', color: 0xb2b6bb, roughness: 0.2, metalness: 0.6, flatShading: true });
const handleMat = new THREE.MeshStandardMaterial({ name: 'handle', color: 0xc38d55, roughness: 0.75, flatShading: true });
const handleDarkMat = new THREE.MeshStandardMaterial({ name: 'handleDark', color: 0x7f5c37, roughness: 0.85, flatShading: true });
const barkMat = new THREE.MeshStandardMaterial({ name: 'bark', color: 0x5b3e27, roughness: 1, flatShading: true });
const woodMat = new THREE.MeshStandardMaterial({ name: 'wood', color: 0xd6ad78, roughness: 0.9, flatShading: true });
const ringMat = new THREE.MeshStandardMaterial({ name: 'ring', color: 0xb48650, roughness: 0.9, flatShading: true });
const crackMat = new THREE.MeshStandardMaterial({ name: 'crack', color: 0x3b2818, roughness: 1, flatShading: true });
// Shared geometries
const boxGeo = new THREE.BoxGeometry(0.006, 0.004, 0.15);
const cylinderGeo = new THREE.CylinderGeometry(0.02, 0.06, 0.15, 5);
// Parts
const block = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.25, 0.275, 0.42, 10), 0.008, 5), barkMat);
block.name = 'block';
block.position.set(0, 0.21, 0);
root.add(block);
const blockTop = new THREE.Mesh(new THREE.CylinderGeometry(0.238, 0.238, 0.014, 10), woodMat);
blockTop.name = 'blockTop';
blockTop.position.set(0, 0.421, 0);
blockTop.rotation.set(0, deg(18), 0);
root.add(blockTop);
const treeRing = new THREE.Mesh(new THREE.CylinderGeometry(0.1375, 0.1375, 0.004, 10), ringMat);
treeRing.name = 'treeRing';
treeRing.position.set(0, 0.429, 0);
treeRing.rotation.set(0, deg(18), 0);
root.add(treeRing);
const treeRingInner = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.05, 0.004, 8), ringMat);
treeRingInner.name = 'treeRingInner';
treeRingInner.position.set(0, 0.431, 0);
root.add(treeRingInner);
const crack = new THREE.Mesh(boxGeo, crackMat);
crack.name = 'crack';
crack.position.set(0.047, 0.43, 0.1292);
crack.rotation.set(0, deg(20), 0);
root.add(crack);
const crack2 = new THREE.Mesh(boxGeo, crackMat);
crack2.name = 'crack';
crack2.position.set(0.0972, 0.43, -0.0972);
crack2.rotation.set(0, deg(135), 0);
root.add(crack2);
const crack3 = new THREE.Mesh(boxGeo, crackMat);
crack3.name = 'crack';
crack3.position.set(-0.1292, 0.43, -0.047);
crack3.rotation.set(0, deg(250), 0);
root.add(crack3);
const root1 = new THREE.Group();
root1.name = 'root1';
root1.rotation.set(0, deg(40), 0);
root.add(root1);
const root2 = new THREE.Mesh(cylinderGeo, barkMat);
root2.name = 'root';
root2.position.set(0, 0.05, 0.26);
root2.rotation.set(deg(115), 0, 0);
root1.add(root2);
const root22 = new THREE.Group();
root22.name = 'root2';
root22.rotation.set(0, deg(145), 0);
root.add(root22);
const root3 = new THREE.Mesh(cylinderGeo, barkMat);
root3.name = 'root';
root3.position.set(0, 0.05, 0.26);
root3.rotation.set(deg(115), 0, 0);
root22.add(root3);
const root32 = new THREE.Group();
root32.name = 'root3';
root32.rotation.set(0, deg(220), 0);
root.add(root32);
const root4 = new THREE.Mesh(cylinderGeo, barkMat);
root4.name = 'root';
root4.position.set(0, 0.05, 0.26);
root4.rotation.set(deg(115), 0, 0);
root32.add(root4);
const root42 = new THREE.Group();
root42.name = 'root4';
root42.rotation.set(0, deg(325), 0);
root.add(root42);
const root5 = new THREE.Mesh(cylinderGeo, barkMat);
root5.name = 'root';
root5.position.set(0, 0.05, 0.26);
root5.rotation.set(deg(115), 0, 0);
root42.add(root5);
const axe = new THREE.Group();
axe.name = 'axe';
axe.rotation.set(0, deg(28), 0);
root.add(axe);
const tool = new THREE.Group();
tool.name = 'tool';
tool.position.set(-0.4399, 0.9763, 0);
tool.rotation.set(0, 0, deg(-122));
axe.add(tool);
const handle = new THREE.Mesh(tube([[0, 0.02, 0], [0.007, 0.24, 0], [-0.003, 0.52, 0], [0, 0.8, 0]], 0.019, 10, 6), handleMat);
handle.name = 'handle';
handle.scale.set(1, 1, 0.75);
tool.add(handle);
const knob = new THREE.Mesh(new THREE.SphereGeometry(0.028, 6, 4), handleDarkMat);
knob.name = 'knob';
knob.position.set(0.002, 0.02, 0);
knob.scale.set(1.1, 0.8, 0.85);
tool.add(knob);
const head = new THREE.Group();
head.name = 'head';
head.position.set(0, 0.75, 0);
head.scale.setScalar(1.3);
tool.add(head);
const eye = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.08, 0.036), steelMat);
eye.name = 'eye';
eye.position.set(-0.002, 0, 0);
head.add(eye);
const poll = new THREE.Mesh(new THREE.BoxGeometry(0.016, 0.07, 0.032), steelMat);
poll.name = 'poll';
poll.position.set(-0.03, 0, 0);
head.add(poll);
const wedge = new THREE.Mesh(new THREE.BoxGeometry(0.022, 0.008, 0.02), handleDarkMat);
wedge.name = 'wedge';
wedge.position.set(-0.002, 0.0405, 0);
head.add(wedge);
const cheek = new THREE.Mesh(extrude([[0.02, -0.036], [0.05, -0.0396], [0.08, -0.0478], [0.11, -0.0596], [0.11, 0.0533], [0.08, 0.0469], [0.05, 0.0404], [0.02, 0.034]], 0.026), steelMat);
cheek.name = 'cheek';
head.add(cheek);
const bit = new THREE.Mesh(extrude([[0.09, -0.0514], [0.1133, -0.0611], [0.1367, -0.0727], [0.16, -0.086], [0.17, -0.061], [0.1773, -0.036], [0.18, -0.011], [0.1773, 0.014], [0.17, 0.039], [0.16, 0.064], [0.1367, 0.059], [0.1133, 0.054], [0.09, 0.049]], 0.012), steelMat);
bit.name = 'bit';
head.add(bit);
const edge = new THREE.Mesh(extrude([[0.145, -0.0772], [0.15, -0.0801], [0.155, -0.083], [0.16, -0.086], [0.17, -0.061], [0.1773, -0.036], [0.18, -0.011], [0.1773, 0.014], [0.17, 0.039], [0.16, 0.064], [0.155, 0.0629], [0.15, 0.0619], [0.145, 0.0608]], 0.005), edgeMat);
edge.name = 'edge';
head.add(edge);
const firewood = new THREE.Group();
firewood.name = 'firewood';
firewood.position.set(0.44, 0, 0.2);
firewood.rotation.set(0, deg(70), 0);
root.add(firewood);
const splitLog = new THREE.Mesh(extrude([[0, 0], [0.1, 0], [0.0866, 0.05], [0.05, 0.0866], [0, 0.1]], 0.32), woodMat);
splitLog.name = 'splitLog';
firewood.add(splitLog);
const splitBark = new THREE.Mesh(new THREE.CylinderGeometry(0.104, 0.104, 0.3136, 3, 1, true, Math.PI / 2, Math.PI / 2), barkMat);
splitBark.name = 'splitBark';
splitBark.rotation.set(deg(90), 0, 0);
firewood.add(splitBark);
const firewood2 = new THREE.Group();
firewood2.name = 'firewood';
firewood2.position.set(0.36, 0, -0.3);
firewood2.rotation.set(0, deg(-20), 0);
root.add(firewood2);
const splitLog2 = new THREE.Mesh(extrude([[0, 0], [0.105, 0], [0.0909, 0.0525], [0.0525, 0.0909], [0, 0.105]], 0.34), woodMat);
splitLog2.name = 'splitLog';
firewood2.add(splitLog2);
const splitBark2 = new THREE.Mesh(new THREE.CylinderGeometry(0.1092, 0.1092, 0.3332, 3, 1, true, Math.PI / 2, Math.PI / 2), barkMat);
splitBark2.name = 'splitBark';
splitBark2.rotation.set(deg(90), 0, 0);
firewood2.add(splitBark2);
const firewood3 = new THREE.Group();
firewood3.name = 'firewood';
firewood3.position.set(-0.12, 0, 0.45);
firewood3.rotation.set(0, deg(15), 0);
root.add(firewood3);
const splitLog3 = new THREE.Mesh(extrude([[0, 0], [0.095, 0], [0.0823, 0.0475], [0.0475, 0.0823], [0, 0.095]], 0.36), woodMat);
splitLog3.name = 'splitLog';
firewood3.add(splitLog3);
const splitBark3 = new THREE.Mesh(new THREE.CylinderGeometry(0.0988, 0.0988, 0.3528, 3, 1, true, Math.PI / 2, Math.PI / 2), barkMat);
splitBark3.name = 'splitBark';
splitBark3.rotation.set(deg(90), 0, 0);
firewood3.add(splitBark3);
const chip = new THREE.Mesh(new THREE.BoxGeometry(0.0343, 0.008, 0.0273), ringMat);
chip.name = 'chip';
chip.position.set(0.1435, 0.004, 0.4299);
chip.rotation.set(0, deg(130.2848), 0);
root.add(chip);
const chip2 = new THREE.Mesh(new THREE.BoxGeometry(0.0576, 0.008, 0.017), woodMat);
chip2.name = 'chip';
chip2.position.set(-0.1302, 0.004, -0.322);
chip2.rotation.set(0, deg(113.8123), 0);
root.add(chip2);
const chip3 = new THREE.Mesh(new THREE.BoxGeometry(0.0385, 0.008, 0.0291), woodMat);
chip3.name = 'chip';
chip3.position.set(-0.1302, 0.004, -0.3843);
chip3.rotation.set(0, deg(51.664), 0);
root.add(chip3);
const chip4 = new THREE.Mesh(new THREE.BoxGeometry(0.041, 0.008, 0.023), ringMat);
chip4.name = 'chip';
chip4.position.set(-0.0514, 0.004, -0.4124);
chip4.rotation.set(0, deg(161.5389), 0);
root.add(chip4);
const chip5 = new THREE.Mesh(new THREE.BoxGeometry(0.0562, 0.008, 0.0178), woodMat);
chip5.name = 'chip';
chip5.position.set(0.2536, 0.004, -0.2856);
chip5.rotation.set(0, deg(121.9108), 0);
root.add(chip5);
const chip6 = new THREE.Mesh(new THREE.BoxGeometry(0.0563, 0.008, 0.0181), woodMat);
chip6.name = 'chip';
chip6.position.set(-0.1547, 0.004, 0.2671);
chip6.rotation.set(0, deg(94.7441), 0);
root.add(chip6);
const chip7 = new THREE.Mesh(new THREE.BoxGeometry(0.055, 0.008, 0.0256), ringMat);
chip7.name = 'chip';
chip7.position.set(-0.3132, 0.004, 0.0116);
chip7.rotation.set(0, deg(35.4236), 0);
root.add(chip7);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createWoodcutterAxe;
Bewertungen & Kommentare
—
Noch keine Bewertungen — gib die erste ab.
5
0
4
0
3
0
2
0
1
0
Melde dich an, um zu bewerten und zu kommentieren.
0 Kommentare
Noch keine Kommentare. Erzähl, wie du dieses Modell genutzt hast oder was besser sein könnte.
Ähnliche Modelle
Gleiche Kategorie oder ähnliche Tags









