Build 3D geometry with JavaScript. Use Three.js constructors or raw vertex data to create procedural shapes, and see results instantly in the live preview.
const geometry = new THREE.BufferGeometry(); const vertices = new Float32Array([ // Nose tip 0, 2, 0, // Upper body ring -0.3, 0.8, 0.3, 0.3, 0.8, 0.3, 0.3, 0.8, -0.3, -0.3, 0.8, -0.3, // Lower body ring -0.3, -0.5, 0.3, 0.3, -0.5, 0.3, 0.3, -0.5, -0.3, -0.3, -0.5, -0.3, // Fin tips -0.9, -1.5, 0, 0, -1.5, 0.9, 0.9, -1.5, 0, 0, -1.5, -0.9, ]); const indices = new Uint16Array([ 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 8, 3, 8, 4, 4, 8, 5, 4, 5, 1, 5, 8, 7, 5, 7, 6, 5, 9, 8, 6, 5, 10, 7, 6, 11, 8, 7, 12, ]); geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); geometry.setIndex(new THREE.BufferAttribute(indices, 1)); geometry.computeVertexNormals(); return geometry;
Your code has access to THREE and must return a BufferGeometry. Use constructors like BoxGeometry, SphereGeometry, or build from scratch with BufferAttribute.
Ready to drop your custom meshes into a full physics simulation?
Open the Full Studio