[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. useLoader already attaches nodes/materials to any result with a .scene (packages/fiber/src/core/hooks/useLoader.tsx:49), and useGraph is exported. useGLTF adds the default GLTFLoader, Draco/Meshopt/KTX2 setup, and preload/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, KTX2Loader and the Meshopt decoder all ship in three/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's useGLTF points 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 whether raw.githack.com is appropriate for production use.
  • API parity with drei. Signature, useGLTF.preload, useGLTF.clear, and the useDraco / useMeshopt / extendLoader arguments.

Rollout

  • Add useGLTF to 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/drei to @react-three/fiber.
  • Add a section to docs/migration/v10.mdx.

Source: pmndrs/react-three-fiber