Codels
1020 三角面0.25 × 0.21 × 0.23 m

在代码中使用

在编辑器中改编
自包含的 ES 模块,仅依赖 three。调用工厂函数,然后把返回的 group 添加到场景中。
/**
 * Frog — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 1,020 · Size (W × H × D): 0.25 × 0.21 × 0.23 m
 *
 * Usage:
 *   import { createFrog } from './frog.js';
 *   
 *   const model = createFrog();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

export function createFrog() {
  const root = new THREE.Group();
  root.name = 'Frog';

  // Materials
  const skinMat = new THREE.MeshStandardMaterial({ name: 'skin', color: 0x5dbb4a, roughness: 0.55, flatShading: true });
  const spotMat = new THREE.MeshStandardMaterial({ name: 'spot', color: 0x3c7a30, roughness: 0.6, flatShading: true });
  const bellyMat = new THREE.MeshStandardMaterial({ name: 'belly', color: 0xefe7a6, roughness: 0.7, flatShading: true });
  const eyeWhiteMat = new THREE.MeshStandardMaterial({ name: 'eyeWhite', color: 0xfbfbf6, roughness: 0.3, flatShading: true });
  const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x191519, roughness: 0.3, flatShading: true });
  const blushMat = new THREE.MeshStandardMaterial({ name: 'blush', color: 0xf29a9a, roughness: 0.7, flatShading: true });

  // Shared geometries
  const boxGeo = new THREE.BoxGeometry(0.045, 0.05, 0.1);
  const boxGeo2 = new THREE.BoxGeometry(0.05, 0.012, 0.08);
  const boxGeo3 = new THREE.BoxGeometry(0.012, 0.01, 0.035);
  const boxGeo4 = new THREE.BoxGeometry(0.028, 0.06, 0.028);
  const boxGeo5 = new THREE.BoxGeometry(0.05, 0.012, 0.04);
  const boxGeo6 = new THREE.BoxGeometry(0.01, 0.01, 0.025);
  const boxGeo7 = new THREE.BoxGeometry(0.006, 0.016, 0.03);
  const boxGeo8 = new THREE.BoxGeometry(0.01, 0.006, 0.006);
  const sphereGeo = new THREE.SphereGeometry(0.037, 8, 6);
  const sphereGeo2 = new THREE.SphereGeometry(0.032, 10, 8);
  const sphereGeo3 = new THREE.SphereGeometry(0.017, 8, 6);
  const boxGeo9 = new THREE.BoxGeometry(0.008, 0.008, 0.004);

  // Parts
  const body = new THREE.Group();
  body.name = 'body';
  root.add(body);
  const torso = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.085, 0.14), skinMat);
  torso.name = 'torso';
  torso.position.set(0, 0.058, -0.03);
  torso.rotation.set(deg(-20), 0, 0);
  body.add(torso);
  const belly = new THREE.Mesh(new THREE.BoxGeometry(0.11, 0.07, 0.012), bellyMat);
  belly.name = 'belly';
  belly.position.set(0, 0.052, 0.04);
  belly.rotation.set(deg(-20), 0, 0);
  body.add(belly);
  const backSpot = new THREE.Mesh(new THREE.BoxGeometry(0.022, 0.006, 0.022), spotMat);
  backSpot.name = 'backSpot';
  backSpot.position.set(0.035, 0.0998, -0.0452);
  backSpot.rotation.set(deg(-20), 0, 0);
  body.add(backSpot);
  const backSpot2 = new THREE.Mesh(new THREE.BoxGeometry(0.018, 0.006, 0.018), spotMat);
  backSpot2.name = 'backSpot';
  backSpot2.position.set(-0.04, 0.0896, -0.0734);
  backSpot2.rotation.set(deg(-20), 0, 0);
  body.add(backSpot2);
  const backSpot3 = new THREE.Mesh(new THREE.BoxGeometry(0.016, 0.006, 0.016), spotMat);
  backSpot3.name = 'backSpot';
  backSpot3.position.set(0, 0.0793, -0.1016);
  backSpot3.rotation.set(deg(-20), 0, 0);
  body.add(backSpot3);
  const backSpot4 = new THREE.Mesh(new THREE.BoxGeometry(0.014, 0.006, 0.014), spotMat);
  backSpot4.name = 'backSpot';
  backSpot4.position.set(-0.015, 0.1067, -0.0264);
  backSpot4.rotation.set(deg(-20), 0, 0);
  body.add(backSpot4);
  const legBL = new THREE.Group();
  legBL.name = 'legBL';
  legBL.position.set(0.07, 0.035, -0.05);
  root.add(legBL);
  const thighL = new THREE.Mesh(boxGeo, skinMat);
  thighL.name = 'thighL';
  thighL.position.set(0.018, 0, 0);
  thighL.rotation.set(deg(18), 0, 0);
  legBL.add(thighL);
  const hindFootL = new THREE.Mesh(boxGeo2, skinMat);
  hindFootL.name = 'hindFootL';
  hindFootL.position.set(0.032, -0.029, 0.05);
  legBL.add(hindFootL);
  const toeL1 = new THREE.Mesh(boxGeo3, skinMat);
  toeL1.name = 'toeL1';
  toeL1.position.set(0.0245, -0.03, 0.1);
  toeL1.rotation.set(0, deg(-22), 0);
  legBL.add(toeL1);
  const toeL2 = new THREE.Mesh(boxGeo3, skinMat);
  toeL2.name = 'toeL2';
  toeL2.position.set(0.032, -0.03, 0.1);
  legBL.add(toeL2);
  const toeL3 = new THREE.Mesh(boxGeo3, skinMat);
  toeL3.name = 'toeL3';
  toeL3.position.set(0.0395, -0.03, 0.1);
  toeL3.rotation.set(0, deg(22), 0);
  legBL.add(toeL3);
  const legBR = new THREE.Group();
  legBR.name = 'legBR';
  legBR.position.set(-0.07, 0.035, -0.05);
  root.add(legBR);
  const thighR = new THREE.Mesh(boxGeo, skinMat);
  thighR.name = 'thighR';
  thighR.position.set(-0.018, 0, 0);
  thighR.rotation.set(deg(18), 0, 0);
  legBR.add(thighR);
  const hindFootR = new THREE.Mesh(boxGeo2, skinMat);
  hindFootR.name = 'hindFootR';
  hindFootR.position.set(-0.032, -0.029, 0.05);
  legBR.add(hindFootR);
  const toeR1 = new THREE.Mesh(boxGeo3, skinMat);
  toeR1.name = 'toeR1';
  toeR1.position.set(-0.0395, -0.03, 0.1);
  toeR1.rotation.set(0, deg(-22), 0);
  legBR.add(toeR1);
  const toeR2 = new THREE.Mesh(boxGeo3, skinMat);
  toeR2.name = 'toeR2';
  toeR2.position.set(-0.032, -0.03, 0.1);
  legBR.add(toeR2);
  const toeR3 = new THREE.Mesh(boxGeo3, skinMat);
  toeR3.name = 'toeR3';
  toeR3.position.set(-0.0245, -0.03, 0.1);
  toeR3.rotation.set(0, deg(22), 0);
  legBR.add(toeR3);
  const legFL = new THREE.Group();
  legFL.name = 'legFL';
  legFL.position.set(0.055, 0.06, 0.055);
  root.add(legFL);
  const armL = new THREE.Mesh(boxGeo4, skinMat);
  armL.name = 'armL';
  armL.position.set(0, -0.03, 0);
  legFL.add(armL);
  const handL = new THREE.Mesh(boxGeo5, skinMat);
  handL.name = 'handL';
  handL.position.set(0.008, -0.054, 0.01);
  legFL.add(handL);
  const fingerL1 = new THREE.Mesh(boxGeo6, skinMat);
  fingerL1.name = 'fingerL1';
  fingerL1.position.set(0.0012, -0.055, 0.035);
  fingerL1.rotation.set(0, deg(-25), 0);
  legFL.add(fingerL1);
  const fingerL2 = new THREE.Mesh(boxGeo6, skinMat);
  fingerL2.name = 'fingerL2';
  fingerL2.position.set(0.008, -0.055, 0.035);
  legFL.add(fingerL2);
  const fingerL3 = new THREE.Mesh(boxGeo6, skinMat);
  fingerL3.name = 'fingerL3';
  fingerL3.position.set(0.0148, -0.055, 0.035);
  fingerL3.rotation.set(0, deg(25), 0);
  legFL.add(fingerL3);
  const legFR = new THREE.Group();
  legFR.name = 'legFR';
  legFR.position.set(-0.055, 0.06, 0.055);
  root.add(legFR);
  const armR = new THREE.Mesh(boxGeo4, skinMat);
  armR.name = 'armR';
  armR.position.set(0, -0.03, 0);
  legFR.add(armR);
  const handR = new THREE.Mesh(boxGeo5, skinMat);
  handR.name = 'handR';
  handR.position.set(-0.008, -0.054, 0.01);
  legFR.add(handR);
  const fingerR1 = new THREE.Mesh(boxGeo6, skinMat);
  fingerR1.name = 'fingerR1';
  fingerR1.position.set(-0.0148, -0.055, 0.035);
  fingerR1.rotation.set(0, deg(-25), 0);
  legFR.add(fingerR1);
  const fingerR2 = new THREE.Mesh(boxGeo6, skinMat);
  fingerR2.name = 'fingerR2';
  fingerR2.position.set(-0.008, -0.055, 0.035);
  legFR.add(fingerR2);
  const fingerR3 = new THREE.Mesh(boxGeo6, skinMat);
  fingerR3.name = 'fingerR3';
  fingerR3.position.set(-0.0012, -0.055, 0.035);
  fingerR3.rotation.set(0, deg(25), 0);
  legFR.add(fingerR3);
  const head = new THREE.Group();
  head.name = 'head';
  head.position.set(0, 0.09, 0.03);
  head.rotation.set(deg(-6), 0, 0);
  root.add(head);
  const skull = new THREE.Mesh(new THREE.BoxGeometry(0.17, 0.07, 0.11), skinMat);
  skull.name = 'skull';
  skull.position.set(0, 0.03, 0.035);
  head.add(skull);
  const jaw = new THREE.Mesh(new THREE.BoxGeometry(0.174, 0.022, 0.066), bellyMat);
  jaw.name = 'jaw';
  jaw.position.set(0, 0.004, 0.059);
  head.add(jaw);
  const mouthLine = new THREE.Mesh(new THREE.BoxGeometry(0.174, 0.006, 0.114), darkMat);
  mouthLine.name = 'mouthLine';
  mouthLine.position.set(0, 0.019, 0.035);
  head.add(mouthLine);
  const cheekL = new THREE.Mesh(boxGeo7, blushMat);
  cheekL.name = 'cheekL';
  cheekL.position.set(0.086, 0.038, 0.055);
  head.add(cheekL);
  const nostril = new THREE.Mesh(boxGeo8, darkMat);
  nostril.name = 'nostril';
  nostril.position.set(0.018, 0.066, 0.078);
  head.add(nostril);
  const cheekR = new THREE.Mesh(boxGeo7, blushMat);
  cheekR.name = 'cheekR';
  cheekR.position.set(-0.086, 0.038, 0.055);
  head.add(cheekR);
  const nostril2 = new THREE.Mesh(boxGeo8, darkMat);
  nostril2.name = 'nostril';
  nostril2.position.set(-0.018, 0.066, 0.078);
  head.add(nostril2);
  const eyeMoundL = new THREE.Mesh(sphereGeo, skinMat);
  eyeMoundL.name = 'eyeMoundL';
  eyeMoundL.position.set(0.05, 0.067, 0.03);
  head.add(eyeMoundL);
  const eyeL = new THREE.Mesh(sphereGeo2, eyeWhiteMat);
  eyeL.name = 'eyeL';
  eyeL.position.set(0.05, 0.079, 0.038);
  head.add(eyeL);
  const pupilL = new THREE.Mesh(sphereGeo3, darkMat);
  pupilL.name = 'pupilL';
  pupilL.position.set(0.052, 0.079, 0.063);
  pupilL.scale.set(1, 1.2, 0.5);
  head.add(pupilL);
  const eyeShineL = new THREE.Mesh(boxGeo9, eyeWhiteMat);
  eyeShineL.name = 'eyeShineL';
  eyeShineL.position.set(0.056, 0.087, 0.072);
  head.add(eyeShineL);
  const eyeMoundR = new THREE.Mesh(sphereGeo, skinMat);
  eyeMoundR.name = 'eyeMoundR';
  eyeMoundR.position.set(-0.05, 0.067, 0.03);
  head.add(eyeMoundR);
  const eyeR = new THREE.Mesh(sphereGeo2, eyeWhiteMat);
  eyeR.name = 'eyeR';
  eyeR.position.set(-0.05, 0.079, 0.038);
  head.add(eyeR);
  const pupilR = new THREE.Mesh(sphereGeo3, darkMat);
  pupilR.name = 'pupilR';
  pupilR.position.set(-0.052, 0.079, 0.063);
  pupilR.scale.set(1, 1.2, 0.5);
  head.add(pupilR);
  const eyeShineR = new THREE.Mesh(boxGeo9, eyeWhiteMat);
  eyeShineR.name = 'eyeShineR';
  eyeShineR.position.set(-0.044, 0.087, 0.072);
  head.add(eyeShineR);

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

export default createFrog;

评分与评论

—
暂无评分,快来抢先评分吧。
5
0
4
0
3
0
2
0
1
0

登录后即可评分和评论。

0 条评论

暂无评论。分享一下你是如何使用这个模型的,或者有哪些可以改进的地方。

相关模型

同一分类或相似标签