Texture Exporter/three.js
Using it with AI agents
Have a coding agent export your scene through the Blender MCP and set up texture loading in your three.js project.
Texture Exporter’s settings live in your .blend, not in the export dialog. So once you’ve set up your textures, anything that exports the scene as glTF uses them, including an AI coding agent (Claude Code, Codex, Cursor and others) driving Blender through the Blender MCP. The agent is also good at the other half of the job: setting up KTX2Loader and the helper scripts (shared-texture-cache.js and gltf-progress.js) in your three.js project.
What you need
- Texture Exporter installed and enabled (Getting started).
- The Blender MCP add-on, from Blender Lab’s extension repository, enabled and connected to your agent. It needs Blender 5.1 or newer. You only need it for exporting from Blender; setting up three.js loading needs nothing in Blender.
- Texture Export ticked in the glTF export window of the scene, once. It’s saved with the .blend.
A good way to split the work
- You choose texture settings in the Scene panel, using Preview on Models to judge quality. This is where your eye matters.
- You tick Texture Export in File ▸ Export ▸ glTF 2.0 once, and export once to check it’s right.
- The agent re-exports the GLB when the scene changes, and wires the GLB and its textures into your project.
Prompts
Start the agent in your project’s folder, with your .blend open in Blender. For example:
Using the Blender MCP, export the open Blender scene as public/models/room.glb with Blender's glTF exporter.
Texture Export is already set up in the file, so keep its settings. Then load the GLB in this three.js project.
Set up KTX2 texture loading for the GLBs in public/models: copy three's basis transcoder into public/basis,
use one KTX2Loader for the whole app, and keep the transcoder version in step with three.
Our GLBs share a ../textures folder. Add shared-texture-cache.js and gltf-progress.js from
https://tools.ashthornton.dev/blender-texture-exporter/js/ and use them for every GLB, with a loading bar.
Add it to your project’s instructions
To make your agent handle this the same way every time, paste this into your project’s AGENTS.md (or CLAUDE.md, .cursorrules, and so on), adjusting the paths:
## 3D models and textures
GLBs in `public/models/` are exported from Blender with the Texture Exporter add-on. Their textures
are separate .ktx2 / .webp / .avif / .png files in `public/models/textures/`, referenced by relative
URI, so always deploy that folder with the GLBs.
- Load GLBs with one shared GLTFLoader that has a KTX2Loader (`setTranscoderPath('/basis/')`, copied
from three's `examples/jsm/libs/basis/`; keep it on the same version as three) and the
`SharedTextureCache` plugin from `src/lib/shared-texture-cache.js`.
- Use `loadWithProgress` from `src/lib/gltf-progress.js` with `{ skip: hasSharedTexture }` when a
loading bar is needed.
- Don't re-encode, rename or embed the textures: re-export from Blender instead. If you can reach
Blender through the Blender MCP, export with Blender's glTF exporter
(`bpy.ops.export_scene.gltf`); the scene's Texture Export settings are applied automatically.
Working with Blender to TSL
If you also use Blender to TSL, an agent can export a material with it and the textured scene with Texture Exporter in the same session. Mesh-only GLBs that Blender to TSL writes don’t replace the last exported glTF that Texture Exporter tracks.