Ultra async gltf import

Yes, I was using translate to avoid spelling mistakes :frowning:

Yes, when I convert it to GLB format. All the meshes surrounded by the orange frame have the same name and material.

These meshes were separated during the design phase. For example, ‘moddikgorsel1’, ‘moddikgorsel2’, ‘moddikgorsel3’. But now they are all named ‘modkartvizit2’

The abbreviation of this article is ‘mod’, abbreviation of model, ‘dikgorsel’ means vertical visual, 1 2 3 are index numbers.

When I open this optimized file - Babylon.js Sandbox - View glTF, glb, obj and babylon files

I have all moddikgorsels at place

Either I made a huge mistake, or there is something I don’t understand. The names of the glb export I received now are different, but as in the video, when I interact with one of them, the others are triggered.

This is the code I used

mesh.actionManager.registerAction(
						new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, (data) => {
							
								highLighter.innerGlow = false;
								highLighter.outerGlow = true;
								highLighter.addMesh(data.source, new BABYLON.Color3(50, 50, 50, 1), true);
							
						})
					);
					mesh.actionManager.registerAction(
						new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger, (data) => {
							
								highLighter.removeMesh(data.source);
							
						})
					);

Or maybe I’m a real dummy and I don’t know anything about these things.

It is quite diffucult to understand what is happening :slight_smile:
Try to use this file - Babylon.js Sandbox - View glTF, glb, obj and babylon files

Direct link https://raw.githubusercontent.com/eldinor/ForBJS/master/ofis-webp.glb

It has exactly the same geometry as your original GLTF.

Yes, everything is as it should be in the file you uploaded.
Why didn’t it work when I did it? Is there a different setting you use?
There is only one thing I don’t understand, I uploaded the visual video and the texts look a little different.


↑↑ This is the old gltf state


↑↑This is the new glb state


This is the content

Ok, I solved the problem. It was doing it from UV coordinates. How can I preserve these coordinates when exporting?

const mesh = bb_ofis.sahne.getMeshByName('moddikgorsel1');
if (mesh) {
    const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
    let uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind);

    if (!uvs || uvs.length === 0) {
        console.log("UV koordinatları eksik! Manuel olarak oluşturuluyor...");

        uvs = [];
        const boundingInfo = mesh.getBoundingInfo();
        const min = boundingInfo.minimum;
        const max = boundingInfo.maximum;

        for (let i = 0; i < positions.length; i += 3) {
            const x = positions[i];
            const y = positions[i + 1];
            const z = positions[i + 2];

            // UV'yi bounding box'a göre hesapla (düzlemsel haritalama)
            const u = (x - min.x) / (max.x - min.x);
            const v = (z - min.z) / (max.z - min.z); // Z eksenini kullanarak daha stabil bir dağılım sağlar

            uvs.push(u, v);
        }

        // Yeni UV'leri mesh'e uygula
        mesh.setVerticesData(BABYLON.VertexBuffer.UVKind, uvs);
        console.log("Yeni UV koordinatları başarıyla eklendi!");
    }
}

From now on, all I have to do is learn your export settings and then I promise I’ll leave you alone.

No checkboxes checked

Texture resize 1024, texture format webp.

1 Like

Thank you very much indeed. I am very grateful to you.

1 Like