Issue applying optimizeIndices and mesh.simplify on external mesh loaded with AssetManager


assetsManager.onTaskSuccessObservable.add(async (task) => {
    var mainMesh = task.loadedMeshes[0];
    mainMesh.position.x = 0;
    mainMesh.position.y = 1.25;
    mainMesh.scaling.set(0.1,0.1,0.1);

    console.log("PREPARING FOR OPTI")

    await mainMesh.optimizeIndices(async () => {
        await mainMesh.simplify([{distance:40, quality:0.2}], false, BABYLON.SimplificationType.QUADRATIC, function() {
            alert("simplification finished");
        });
    })

Using assets manager to load external stl mesh. everything is working as expected. I then attempt to use optimize indices and simplify and never see the alert. I’ve tried adding awaits, but don’t see any result. poly count remains the same in the debugger. How do I apply these simplications to a mesh referenced via a task?

Also, from a previous post, I saw that you can assign distance: undefined to automatically add these simplifications. when I attempted, I got an error. Any ideas?

Thanks in advance

Hey there! This is a question for @RaananW who created the feature but he is out of office for a long break. So please be patient (Unless someone from the community wants to jump on :))

Hey Michael,

I am finally back. Did you manage to get this to work? would you be able to reproduce that in the playground so I can debug this?

1 Like

Hey! Welcome back. Thanks for checking in. I have not come up with a good solution as of yet. Thanks

1 Like

cool. let’s debug this. can you reproduce this on the playground?

Following up on this, this is a reproduction with a babylon asset, and it seems to work - https://playground.babylonjs.com/#ZJYNY#1783

I wonder if it is the model itself. so reproduction would be really great.