Hi. I’m trying to import units for a game. The units have multiple meshes (e.g. one for the horse, one for the man, one for the weapon).
Model’s format is .obj, there’s also a mtl file and two texture files (for the model that looks wrong).
For some reason, some of the unit look ok and some don’t. What seem to be happening is that the ones that looks wrong are at the ones that have 2 baseColor files instead of one. But I don’t know why this would make a difference. You can see the problem here:
But it looks god when I open it with Windows 10 (Visor 3d).
Also other units with only one baseColor, they look good.
This is the organization of the file:
And this is the initialization code:
const scale = Archive.models[model.key].scale; // Cambiar esto, no debería acceder a archive
// this set multimaterial = true when there is more than 1 material
const multiMaterials = !!task.loadedMeshes.find(m => {
return _.get(m, "material._diffuseTexture.name") !== undefined &&
_.get(task.loadedMeshes[0], "material._diffuseTexture.name") !== _.get(m, "material._diffuseTexture.name");
});
const modelMesh = BABYLON.Mesh.MergeMeshes(task.loadedMeshes, true, true, undefined, false, multiMaterials);
modelMesh.scaling = new BABYLON.Vector3(scale, scale, scale);
modelMesh.setEnabled(false);
For creating them we are using new instances.
Initially I thought it could be because the merge meshes but the same happend when I tried t use a TransformNode instead of mershing the meshes.
UPDATE: to clarify, the problem seem to be that for certain angles certain parts of the image become transparent (e.g. the soldier in the image has beard, but it doesn’t show for some reason in Babylon, although is visible when opening the file in Windows). This is how the soldier should look: