threejs-syntax-loaders

Load 3D models, textures, and HDR environments in Three.js with correct loader configuration.

1|Updated Aug 20, 2023
One-click install
npx skills add https://github.com/imanlangaran/mini-projects --skill threejs-syntax-loaders-imanlangaran
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-syntax-loaders
Source: https://github.com/imanlangaran/mini-projects/tree/main/react/three-gsap/.claude/skills/threejs-syntax-loaders
Command: npx skills add https://github.com/imanlangaran/mini-projects --skill threejs-syntax-loaders-imanlangaran

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three, and includes references (resource) components.

What problem does it solve? Loading 3D assets in Three.js fails in predictable ways: missing DRACOLoader decoder paths, wrong texture color spaces, unhandled load errors, and GPU memory leaks from undisposed models. This Skill provides correct loader setup patterns and anti-patterns so these mistakes are avoided. ## Core Features & Use Cases - Loader Setup Guidance: Covers GLTFLoader, DRACOLoader, KTX2Loader, TextureLoader, CubeTextureLoader, RGBELoader, FBXLoader, OBJLoader, MTLLoader, and LoadingManager with correct import paths and configuration. - Compression Support: Shows how to wire Draco, KTX2, and Meshopt decoders into GLTFLoader, including the mandatory detectSupport(renderer) call for KTX2. - Anti-Pattern Reference: Documents ten common failures such as loading inside the render loop, skipping error handling, and applying SRGBColorSpace to data textures. - Use Case: When adding a Draco-compressed GLB model to a scene, use this Skill to set the decoder path, load with loadAsync inside try/catch, and dispose the decoder afterward. ## Quick Start Use the threejs-syntax-loaders skill to load a Draco-compressed GLB model with progress tracking and proper error handling.

Frequently Asked Questions about threejs-syntax-loaders

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I load a GLTF model with Draco compression in Three.js?

Create a DRACOLoader, call setDecoderPath pointing to the directory containing draco_decoder.wasm, then pass it to GLTFLoader via setDRACOLoader. Load with loadAsync inside try/catch, and call dracoLoader.dispose() after all compressed models finish loading.

How to load an OBJ file with MTL materials in Three.js?

Load the MTL file first with MTLLoader, call materials.preload(), then pass it to OBJLoader via setMaterials before loading the OBJ. Loading OBJ first results in default white materials because materials are assigned at parse time.

Should I use GLTF, FBX, or OBJ for Three.js models?

Prefer glTF/GLB, the recommended format for Three.js, since it supports PBR materials, animations, cameras, and scene hierarchy in one file. Use .glb binary for single-file distribution to avoid missing .bin companion file errors.

Why does my Three.js texture look washed out or have wrong colors?

Color textures like diffuse and emissive maps need texture.colorSpace set to THREE.SRGBColorSpace. Data textures such as normal, roughness, metalness, and AO maps must keep the default NoColorSpace, since gamma correction corrupts their values.

Why does KTX2 texture loading fail in Three.js?

KTX2Loader requires setTranscoderPath pointing to the Basis transcoder files and a detectSupport(renderer) call before loading. Without detectSupport, the transcoder cannot determine which GPU compressed formats are available and fails or picks a bad fallback.

How do I free GPU memory after removing a Three.js model?

Removing a model from the scene does not free GPU memory. Traverse the model and dispose each mesh's geometry, materials, and textures explicitly, then call removeFromParent. Also dispose DRACOLoader and KTX2Loader after loading completes.