threejs-loaders
Agent skill fromCloudAI-X/threejs-skills
Loading three.js assets: glTF with Draco, meshopt and KTX2 compression, other model formats, textures, HDR and EXR environments, progress, caching, cloning and disposal. Use when loading 3D models, textures or environment maps, or managing loading progress, on WebGL or with WebGPU and TSL.
How to install threejs-loaders
install threejs-loaders
# install the threejs-skills pack with the skills CLI
npx skills add CloudAI-X/threejs-skills# or add only this skill to Claude Code: copy the folder
skills/threejs-loaders/
# into
~/.claude/skills/threejs-loaders/ (all projects)
.claude/skills/threejs-loaders/ (one project)
1# Three.js Loaders23Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer.45## Quick Start67```javascript8import * as THREE from "three";9import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";10import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";1112const renderer = new THREE.WebGLRenderer({ antialias: true });13renderer.setPixelRatio(window.devicePixelRatio);14renderer.setSize(window.innerWidth, window.innerHeight);15document.body.appendChild(renderer.domElement);1617const scene = new THREE.Scene();18scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture; // glTF PBR materials render black without lights or an environment1920const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100);21camera.position.set(2, 1.5, 3);22camera.lookAt(0, 0, 0);2324const gltf = await new GLTFLoader().loadAsync("model.glb");25scene.add(gltf.scene);2627function animate() {28 renderer.render(scene, camera);29}3031renderer.setAnimationLoop(animate);32```3334## LoadingManager3536One manager coordinates several loaders and reports combined progress. `loadAsync` still rejects on failure; `manager.onError` fires as well.3738```javascript39import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";4041const manager = new THREE.LoadingManager();4243manager.onStart = (url, loaded, total) => {44 console.log(`Started loading: ${url}`);45};46…
Excerpt shown under the repository's MIT license.
