816 tris0,33 × 0,39 × 0,22 m
Úsalo en código
Hacer remix en el editortrophy.js · 91 líneas
Módulo ES autónomo — solo depende de three. Llama a la función factory y añade el grupo a tu escena.
/**
* Trophy — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 816 · Size (W × H × D): 0.33 × 0.39 × 0.22 m
*
* Usage:
* import { createTrophy } from './trophy.js';
*
* const model = createTrophy();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
// Revolve a 2D profile [[radius, y], ...] around the Y axis.
function lathe(points, segments, phiStart = 0, phiLength = Math.PI * 2) {
return new THREE.LatheGeometry(points.map(([x, y]) => new THREE.Vector2(x, y)), segments, phiStart, phiLength);
}
// 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 createTrophy() {
const root = new THREE.Group();
root.name = 'Trophy';
// Materials
const metalMat = new THREE.MeshStandardMaterial({ name: 'metal', color: 0xe2b13c, roughness: 0.28, metalness: 0.6, flatShading: true });
const metalDarkMat = new THREE.MeshStandardMaterial({ name: 'metalDark', color: 0x9e7c2a, roughness: 0.35, metalness: 0.6, flatShading: true });
const baseMat = new THREE.MeshStandardMaterial({ name: 'base', color: 0x3a2a22, roughness: 0.55, flatShading: true });
const baseTrimMat = new THREE.MeshStandardMaterial({ name: 'baseTrim', color: 0x5d504a, roughness: 0.55, flatShading: true });
const plaqueMat = new THREE.MeshStandardMaterial({ name: 'plaque', color: 0xd9c48a, roughness: 0.35, metalness: 0.5, flatShading: true });
const inkMat = new THREE.MeshStandardMaterial({ name: 'ink', color: 0x3b3226, roughness: 0.8, flatShading: true });
// Parts
const trophy = new THREE.Group();
trophy.name = 'trophy';
root.add(trophy);
const baseLower = new THREE.Mesh(new THREE.BoxGeometry(0.17, 0.05, 0.17), baseMat);
baseLower.name = 'baseLower';
baseLower.position.set(0, 0.025, 0);
trophy.add(baseLower);
const baseTrim = new THREE.Mesh(new THREE.BoxGeometry(0.176, 0.008, 0.176), baseTrimMat);
baseTrim.name = 'baseTrim';
baseTrim.position.set(0, 0.054, 0);
trophy.add(baseTrim);
const baseUpper = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.045, 0.13), baseMat);
baseUpper.name = 'baseUpper';
baseUpper.position.set(0, 0.0805, 0);
trophy.add(baseUpper);
const plaque = new THREE.Mesh(new THREE.BoxGeometry(0.09, 0.03, 0.004), plaqueMat);
plaque.name = 'plaque';
plaque.position.set(0, 0.025, 0.086);
trophy.add(plaque);
const engraving = new THREE.Mesh(new THREE.BoxGeometry(0.06, 0.004, 0.002), inkMat);
engraving.name = 'engraving';
engraving.position.set(0, 0.031, 0.0885);
trophy.add(engraving);
const engraving2 = new THREE.Mesh(new THREE.BoxGeometry(0.04, 0.004, 0.002), inkMat);
engraving2.name = 'engraving';
engraving2.position.set(0, 0.019, 0.0885);
trophy.add(engraving2);
const cup = new THREE.Mesh(lathe([[0, 0], [0.058, 0], [0.058, 0.012], [0.046, 0.02], [0.022, 0.03], [0.015, 0.06], [0.024, 0.08], [0.014, 0.1], [0.02, 0.115], [0.05, 0.13], [0.082, 0.165], [0.097, 0.215], [0.1, 0.265], [0.109, 0.282], [0.103, 0.288], [0.093, 0.276], [0.087, 0.215], [0.07, 0.17], [0, 0.148]], 12), metalMat);
cup.name = 'cup';
cup.position.set(0, 0.103, 0);
trophy.add(cup);
const cupBand = new THREE.Mesh(lathe([[0.0985, 0.236], [0.1015, 0.24], [0.1015, 0.248], [0.0995, 0.252]], 12), metalDarkMat);
cupBand.name = 'cupBand';
cupBand.position.set(0, 0.103, 0);
trophy.add(cupBand);
const handle = new THREE.Mesh(tube([[0.094, 0.361, 0], [0.135, 0.371, 0], [0.158, 0.338, 0], [0.142, 0.293, 0], [0.085, 0.275, 0]], 0.009, 12, 5), metalMat);
handle.name = 'handle';
trophy.add(handle);
const handle2 = new THREE.Mesh(tube([[-0.094, 0.361, 0], [-0.135, 0.371, 0], [-0.158, 0.338, 0], [-0.142, 0.293, 0], [-0.085, 0.275, 0]], 0.009, 12, 5), metalMat);
handle2.name = 'handle';
trophy.add(handle2);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createTrophy;
Valoraciones y comentarios
0 comentarios
Aún no hay comentarios. Cuenta cómo usaste este modelo o qué se podría mejorar.
Modelos relacionados
Misma categoría o etiquetas similares









