Vertex List From Blender to Babylon

Is there a way to get a Mesh resp. Vertices and indices to Babylon in the way I can use it to create meshes using BABYLON.VertexData.positions aso. ?

like this… for example. Must be some kind of exporter??

I want to create some more complex meshes and then modify it in bbln.
Doing that “manually” would be quite a pain.

best. Werner

You could get the indices and positions of a mesh like this if that’s what you’re after? I’m not for sure though if you’re trying to import an existing mesh into your Babylon scene or export one out of your Babylon scene?

const indices = mesh.getIndices();
const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
2 Likes

Adding to what Blake said, you need to get that and then build a string with those, then save it in some way (copy&paste, downloading, showing on console, alert etc).

Made a sample PG for you:

Get indices and positions | Babylon.js Playground (babylonjs.com)

(Check the console as well).

Edit: you certainly is not willing indices and vertices from that sample box. You should change the PG to load your model and get those from it.

Of course, if your object is too complex (too many vertices and triangles), then this won’t be ideal. In that case you probably will want to extend it to download the list as a file, but that is left as an exercise. For a moderately complex model, you can just copy from the console or from the alert. =)

3 Likes

Ah cool. So yes I think that might work.
I would load the model e.g. via gltf and then read out the properties.
Store it in the array and rebuild it.
Thank you very much!
Best. Werner.
Thx for the sample. Thats cool.