maxTextureSize texture in Glft load

Hi, I found that when I export scene to Gltf , I can limit texture size with maxTextureSize option. And If texture is larger than that size, gltf exporter resize automatically.

Is there any option can resize automatically by gltf loader only?
I want to resize texture with gltf loader only!


TBH, I think the addition of maxTextureSize to GLTFExporter was a mistake. Exporters and loaders should not be responsible for resizing textures. These modules should export or import the data as they are.

So adding something like maxTextureSize to GLTFLoader is no option to me. I would rather suggest to remove this option from GLTFExporter. /cc @donmccurdy

The solution is to resize the texture before an export of after the load on app level.

Amm, In My case, importing gltf with texture limit with texture resizing is good option for optimize scene.

That is just my opinion. Maby I have to find out other way to resize texture on load. :face_holding_back_tears:

It’s good to optimize the scene with smaller textures, but not so good to download the whole texture and uncompress it on every client that visits the site. This can be quite a lot of network bandwidth and device memory for large textures. Better to do that offline, for example:

npm install --global @gltf-transform/cli
gltf-transform resize input.glb output.glb --width 1024 --height 1024

@Mugen87 yes, I think I’d agree that this option is not needed on GLTFExporter either.