[v10] Port useGLTF into core as part of the asset pipeline
Author: DennisSmolekCreated Sep 25, 2026Updated Sep 25, 2026
Labelsv10
Summary
Move useGLTF from drei into @react-three/fiber for v10. It's used in the large majority of projects, and it fits the rule we're adopting for what belongs in core: core owns getting assets into the scene correctly for the active renderer. Textures (useTexture, useTextures), useEnvironment and <Environment> already follow that rule.
Why core
- Most of it already exists.
useLoaderalready attachesnodes/materialsto any result with a.scene(packages/fiber/src/core/hooks/useLoader.tsx:49), anduseGraphis exported.useGLTFadds the defaultGLTFLoader, Draco/Meshopt/KTX2 setup, andpreload/clear. - It depends on the renderer. Core has the renderer, so it can run
KTX2Loader.detectSupport(renderer)automatically on both WebGL and WebGPU. - No new npm dependencies.
GLTFLoader,DRACOLoader,KTX2Loaderand the Meshopt decoder all ship inthree/examples/jsm.
To decide
- Policy for default CDNs. Core already has one third-party default: Environment presets load from
raw.githack.com(packages/fiber/src/core/hooks/useEnvironment.tsx:22). drei'suseGLTFpoints Draco at a gstatic CDN by default. Proposal: every decoder and asset path is configurable in one global place, and the defaults are chosen deliberately. Also check whetherraw.githack.comis appropriate for production use. - API parity with drei. Signature,
useGLTF.preload,useGLTF.clear, and theuseDraco/useMeshopt/extendLoaderarguments.
Rollout
- Add
useGLTFto core and export it from all entries. - drei's release for fiber v10 re-exports fiber's
useGLTF, so there is a single loader cache. Two implementations would load the same URL twice or apply different loader settings. - gltfjsx switches its generated import from
@react-three/dreito@react-three/fiber. - Add a section to
docs/migration/v10.mdx.
Source: pmndrs/react-three-fiber