Repository navigation
3D model viewer without Three.js
model3d.js (new) - a glTF 2.0 viewer (.glb and .gltf) written from scratch, with no Three.js: its own binary GLB parser, matrix math and shaders, on WebGL2 with an automatic WebGL1 fallback. About 14 KB gzipped.
createViewer(id, options)andloadModel(id, url | File | ArrayBuffer, responseFunction)(also awaitable); the camera fits the model automatically.- Orbit, pan and zoom with mouse, touch and keyboard; double-click to focus a point; optional auto-rotate.
onModelClickreports the part that was clicked, its path in the node tree and the 3D point.- Parts (glTF nodes) by name:
getParts,setPartColor,setPartVisible,highlightPart,getPartTransform/setPartTransform(position, Euler or quaternion rotation, scale). - Camera:
fitView,setCameraView,getCameraView,setAutoRotate. - Supports textures, vertex colors, transparency (
BLEND/MASK), double-sided materials, interleaved and sparse accessors,KHR_materials_unlit,KHR_materials_emissive_strengthandKHR_mesh_quantization. Draco/meshopt compressed models fail with a clear message.
model3dtools.js (new) - addHotspot (HTML labels pinned to a part or point, dimmed when hidden behind the model), enableTransform (translate/rotate/scale gizmo for mouse and touch, Shift snaps rotation to 15°), and exportGLB / downloadGLB (the edited model, with transforms, colors and hidden parts, as a single .glb).
Examples: 3D model viewer and BTS antenna editor.