Use Tools LoadFile loads multiple glb models with texture disorder

I use Tools LoadFile to load glb, which retrieves the buffer from the callback and then uses IndexDB or other storage to store the buffer. I found that even when loading a large number of glb files for the first time, there is still a problem of texture distortion. I found that the material parsed by each buffer is correct, but the texture may be from another model

	_load(scene: Scene, option: any) {
		const { id, projectId, url, name, fileName, position } = option;
		Tools.LoadFile(
			url,
			buf => {
				SceneLoader.ImportMesh(
					undefined,
					'',
					new Uint8Array(buf as ArrayBuffer),
					scene,
					(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) => {
						console.log('result::', meshes, transformNodes);

						meshes[0].id = projectId || id;
						meshes[0].position.fromArray(position);
						meshes[0].name = name;

						return {
							meshes,
							particleSystems,
							skeletons,
							animationGroups,
							transformNodes,
							geometries,
							lights,
						};
					},
					progress => {
						console.log('load progress', progress);
					},
					error => {
						console.log('load error::', error);
					},
					'.glb',
				);
			},
			undefined,
			undefined,
			true,
		);
	}

Using my method to load more than one model simultaneously externally will result in texture distortion issues


I try to retrieve the buffer synchronously or asynchronously, but this situation occurs

Hello @1114257133 , how are you doing?

We had this issue at some point when loading models using Arrays, but it got solved at some point. Can you tell which version of Babylon.js you are using?

image
Boss, which version are you using?

That’s a little old, if you want to stay using version 6 I think this issue should be fixed in version 6.49.0, but I would recommend updating to the latest version (7.25.1).

1 Like