Closed deepkolos closed 3 years ago
duplicated #21559
but the current GLTFLoader solution may not consider texture's extensions, so i think the solution i provided is better, which can cover ktx2, basis,compressed-texture with fallback or other texture extension with custom loadTexture
funciton and not cache inside
the test page is here
https://deepkolos.github.io/lazy-gltf-loader/examples/texture-test.html
maybe it is a common case that cache doesn't care about extensions. in this case, loadTexture, maybe so does other like loadMesh, loadBufferView, loadMaterial
See https://github.com/mrdoob/three.js/pull/22038#issuecomment-867349612 — I think I would prefer to consider this a bug in the exporting software, rather than trying to detect deeply duplicated resources in a file.
Problem
using the same normalMap texture bewteen diffrent material in blender
blend file: https://github.com/deepkolos/lazy-gltf-loader/blob/main/examples/banzi2.blend
but the exported gltf file will look like this
gltf flile: https://github.com/deepkolos/lazy-gltf-loader/blob/main/examples/banzi2/banzi2.gltf
which means it will create duplicated texture with same source, sampler and extensions, upload duplicated texture to WebGL memory.
Solution
update texture cache key