# Sharing a texture folder

> Export several .blend files into one texture folder, so GLBs share files and URLs, and clean up files nothing uses.

Texture Exporter docs · https://tools.ashthornton.dev/blender-texture-exporter/docs/shared-folders/

Several scenes (separate .blend files, each with its own GLB) can export into one texture folder. Textures they have in common are then stored once, downloaded once and, with the [three.js plugin](https://tools.ashthornton.dev/blender-texture-exporter/docs/threejs.md#several-glbs-sharing-textures), uploaded to the GPU once.

## Set it up

In every .blend that shares the folder:

1. Point the textures at the same folder. For GLBs side by side in `models/`, use **Textures To** `../textures` in the glTF export window (and the same in the Scene panel's **Export To**).
2. Turn on **Hashed File Names**, in the Scene panel under the folder and in the export window.

Files are then named `<image>-<hash>.ktx2` (or `.webp`, `.avif`, `.png`), with the hash taken from the source pixels and the texture's settings:

- **The same image with the same settings gives the same name from any .blend**, so every GLB that uses it references one file and one URL.
- **Two different images that share a name** (`albedo` in both files) get different names, so they never overwrite each other.
- **A file's content never changes under its name**, so your server can cache the folder forever: `Cache-Control: public, max-age=31536000, immutable`.
- **Changing a texture in one .blend writes a new file.** Update glTF points that .blend's GLB at it, and the other scenes keep the file they use.

## The folder manifest

Each texture folder gets a `.texture-exporter.json`, listing the glTFs exported into it and the files the add-on wrote there. Leave it in place; it's what lets the add-on tell its own files from yours. three.js never reads it.

## Clean Up

When the folder holds files that no glTF uses any more, a line under the folder says how many, e.g. *2 unused files in the folder*. The check runs in the background whenever the folder, the manifest or a listed glTF changes, and every 30 seconds while the panel is open.

**Clean Up** (the brush button next to the folder, and in the glTF status box) lists those files, then either **moves them to `_unused/`** inside the folder or **deletes them**:

![The Clean Up Texture Folder dialog: used by 1 of 1 glTF found (sofa.glb), four files no glTF uses, and the buttons Move to _unused and Delete 4 File(s).](https://tools.ashthornton.dev/_astro/clean-up.D_9-B8Mo.png "Clean Up")

How it decides what's unused:

- It reads every glTF listed in the manifest, from any .blend, plus every `.gltf` / `.glb` it finds near the folder (its parent and the listed glTFs' folders, three levels down). What the glTFs on disk reference is what counts.
- **Only files the add-on wrote** are candidates. Your own files in the folder are left alone.
- If a glTF or the manifest can't be read, nothing is moved.
- Just before acting it checks again, and only touches files that are still unused.

> **Watch out**
>
> **Delete** asks for confirmation and is permanent: files don't go to the Recycle Bin. **Move** is the safe choice; delete `_unused/` yourself once you're sure.
>
> A glTF that isn't near the folder and wasn't exported with this add-on (one copied elsewhere by hand, say) can't be seen. If you have glTFs like that, use Move.
