Loading an Obj file is loading each and every quad as separate meshes

I have loaded this mesh into my scene using AssetManager. But on the task onSuccess callback when I inspect I see that each and every quad has been loaded as a separate mesh.

BlueBall01

The above obj file is from kenney.nl - 3d golf asset pack

So this is how I am scaling in order for the entire object to scale. So does with positioning and everything which will be a pain.

const blueBallTask = this.assetsManager.addMeshTask("blue ball task", "", "./models/3d-minigolf-pack/Models/", "Ball_blue_01.obj");
blueBallTask.onSuccess = function (task) {
  console.log(task.loadedMeshes[0]);
  task.loadedMeshes.map((mesh) => {
    mesh.position = Vector3.Zero();
    mesh.useVertexColors = true;
    mesh.scaling = new Vector3(10, 10, 10);
  });
}

I have loaded the obj file in the inspector and it shows indeed each and every quad as a separate mesh and 594 draw calls for a sphere :frowning:

Hi!
Is it possible that you provide a PlayGround Example for this?
Consider a view into Using External Assets - Babylon.js Documentation for this…

1 Like

@wulf11 Hi it seems like a problem with the obj file itself. No issues with Babylon

1 Like

@vickylance : I looked at the .obj and .mtl file. There are two materials white and blue but only blue is visible in the sandbox… When I imported them into Blender you see both the materials. I exported it out as an .obj file again and checked the sandbox - I see both materials now - and it is just a single mesh.

So I think you are right it is the .obj file.

I notice that the original file seems to have come from SketchUp - issue with the export there ?

cheers, gryff :slight_smile:

1 Like

@gryff Hi thanks for taking time in checking the obj file. Yeah that file is from sketchup. I did not create that file. Its from kenney.nl asset. Seems like that is the case with all the assets in this pack.


I tested all the assets in this pack and all other 3d packs from kenney. Only this pack is completely screwed up. His other packs seems to work just fine except some minor issues.