/qadri-3d:threejs-product-viewerfrom qadri-3d
Build an interactive 3D product viewer for a website with three.js. The viewer loads a glTF/GLB model, frames it automatically, lights it like a studio and lets shoppers orbit and zoom. Use when the user wants a 3D product view, "show our product in 3D", a GLB/glTF viewer, a three.js product page, an e-commerce 3D model, or a rotatable model of furniture, shoes, bottles, electronics, cabinets or any physical product. Includes a tested starter template. For color/material options see product-configurator; for a no-code embed with AR see model-viewer-ar.
Ships in qadri-3d. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build a viewer that is fast on phones, accurate in color, and framed well for any model. Start from the tested template, then adapt it:
templates/product-viewer.html is one self-contained file. It uses three.js r186 from a CDN import map, so it needs no build step.
<model-viewer>?| Need | Use |
|---|---|
| Just show a model, maybe with AR, with minimal code | <model-viewer> (model-viewer-ar skill) |
| Custom UI, a configurator, animations, several models in one scene, brand-specific effects | three.js (this skill) |
| No 3D model, only photos | A 360° image sequence (360-product-spin skill) |
three and three/addons/, pinned to one exact version.
three/addons/…, which maps to examples/jsm/.antialias: true and alpha: true, so the page background shows through.setPixelRatio(Math.min(devicePixelRatio, 2)). Uncapped DPR 3 phones render 2.25× the pixels for no visible gain.toneMapping = THREE.NeutralToneMapping, which keeps product colors close to the source.outputColorSpace stays at the default sRGB.RoomEnvironment through PMREMGenerator, set as scene.environment. PBR materials (the glTF default) look flat without an environment map; a single directional light is not enough.ShadowMaterial ground plane that receives the shadow of one directional light. The shadow camera is fitted to the model's size.THREE.PCFShadowMap and soften it with shadow.radius. PCFSoftShadowMap was removed in r18x; three.js warns and falls back.Box3, moves the model so it sits centered on the floor, and places the camera at a distance of radius / sin(fov/2).near, far, minDistance and maxDistance from the model's size.OrbitControls with damping, panning off and maxPolarAngle just under 90° (no looking from under the floor). It auto-rotates until the first interaction, and not at all under prefers-reduced-motion.setAnimationLoop, it renders only when controls.update() returns true (the camera moved) or something requested a render. An idle product page then uses almost no GPU or battery.GLTFLoader with DRACOLoader, KTX2Loader (with detectSupport(renderer)) and MeshoptDecoder, so optimized files load. See the 3d-asset-optimization skill.role="img" and an aria-label.MODEL_URL. Files must be served over HTTP; file:// fails because of CORS. For quick tests use ?model=path/to/file.glb.ResizeObserver on the container, not window.resize, so it works in grids, tabs and modals.IntersectionObserver, because browsers cap the number of live WebGL contexts, typically around 16.vector.project(camera) into CSS pixels, and update it when rendering.scene.environmentIntensity) and the background (a CSS gradient behind the transparent canvas).When removing the viewer, call:
renderer.setAnimationLoop(null)controls.dispose()renderer.dispose()Also traverse the model and dispose every geometry, material and texture. Otherwise GPU memory leaks with each open and close.
| Item | Target on mid-range phones |
|---|---|
| Model download | < 2–3 MB compressed (optimize first) |
| Triangles | ≲ 100k for a single product |
| Textures | ≤ 2048², KTX2 or WebP; share materials |
| Draw calls | ≲ 50 (merge meshes that share a material) |
| Idle GPU | ~0 (render on demand) |
touch-action: none on the canvas.NeutralToneMapping exposure (renderer.toneMappingExposure) rather than editing the materials.file://: use a local server such as npx serve or python -m http.server.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub qadri-uk/claude-skills --plugin qadri-3d71 skills in this plugin
/360-product-spinAdd a 360° product spin (a draggable image sequence) to a product page, and produce the frames by photographing the product on a turntable or rendering a 3D model with three.js. Use when the user wants a 360 view, a spin or rotating product photos, "turn the product around", a 360 product viewer, sprite sheets for product rotation, or has product photos but no 3D model. Uses the zero-dependency Spin360 web component./3d-3d-cloth-materialBuild convincing woven cloth in Three.js, with a thread-level weave normal map, sheen and anisotropic highlights, folds that never stretch the texture, hems with thickness, stitches, seams, frayed edges, fold occlusion, dye and wear variation, and light passing through thin fabric. Use for linen, silk, wool, canvas, curtains, banners, cloaks, tablecloths, tapestries or any 3D drape that currently looks like a plastic sheet, a stretched texture, or a flat coloured plane./3d-3d-falling-leavesBuild recognizable falling leaves in world space using instanced geometry, independent tumble, coupled sideways drift, shared wind, scene occlusion, and camera-aware recycling. Use for 3D autumn leaves or drifting foliage in Three.js and similar scenes; use falling-leaves for a 2D canvas overlay.Other plugins' skills for the same job