Use GLTFExporter Export textures separately

Can I add a separate export texture?We need to increase this demand

What happens if your set the parsing option embedImages to false? Check out the documentation for more details?

https://threejs.org/docs/index.html?q=gltfex#examples/en/exporters/GLTFExporter.parse

This example does not save the texture separately. Save the texture separately to the picture, which is convenient for me to modify the picture

When embedImages is false the exporter should just put the filename of the image (e.g. baseColor.png) into the glTF file. Saving the image to disk would need to be done in your code.

1 Like

Isn’t that troublesome

My recommendation would be to export a GLB and unpack it after export.

If you’d prefer to create something that exports a ZIP, or some other representation of multiple files, you can always modify GLTFExporter.js to do so.

1 Like

Example:

import { WebIO } from '@gltf-transform/core';

const io = new WebIO();
const exporter = new THREE.GLTFExporter();

exporter.parse(scene, (buffer) => {
  const json = io.binaryToJSON(buffer);
  console.log(json.resources);
}, {binary: true});

1 Like

Thank you. It seems that it still needs to be realized with the help of external programs