GLB: where does the name "_primitive1" come from?

I have received a model from blender.
There you have e.g. Mesh “pic1”.
But in sandbox.babylonjs I already see other naming:
“pic1__primitive1” and “pic1__primitive0”.

When does this new name come?
Thanks (532.5 KB)

This is because the GLB contains several primitives (pointing to geometries inside the file)

How does it look like in Blender? (are you using instances maybe?)

I think it just comes down to what Deltakosh is saying about how the glb creates “primitives” in how it stores the geometry information in the file. But to compare, I’m using screenshots from one of my own blender glb exports.

Here’s a screen shot of a blend file.

Screenshot from 2021-08-23 22-49-18

It has a Ferarri I got from cgtrader. The main object model “Ferarri Testarossa” is a single mesh object which contains the body, interior . There are separate meshes for the wheels (named “FL, FR, RL, RR” etc). Those are “children” of the Ferarri mesh, but aren’t “joined” to the same object in Blender. They are separate objects, and you have to go into “edit mode” separately for each of them. I"m assuming your knowledge of Blender modelling.

If i export this Ferrari to GLB, the separate, parented meshes have their names show up in the inspector: “Ferarri Testarossa”, “FL”, “FR”, “RL”, “RR”. So the names we give objects in Blender, will show up that way when we import a glb. The primitives though, these are coming from however the glb is storing the geometries. However it does it, It takes the objects name, and appends “_primitive0”…etc etc to however many primitives it created for that object. [disclaimer: i had no understanding of this prior to looking at it as a result of this thread]

Screenshot from 2021-08-23 22-40-15

But getting back to your file:
You can access the meshes from the scene object:

const pic1 = scene.getMeshByID("Pic1");
pic1.position.y = ///etc etc, manipulating mesh

Weirdly enough, You can access the primitives with “getMeshById”, but I’m not sure why one would want to ( I imagine moving it or something would just tweak that part of the mesh, deforming it) But for giggles:

            const primitive1 = scene.getMeshByID("Pic1_primitive1");
            //logging to console to verify that variable accesses mesh: 

I wouldn’t really worry about the primitives though. Its going to show each of the object names you’re familiar with, in the inspector, from whatever you had in the Blend file, and you can access and manipulate those.

Basically it’s because in glTF convention, one mesh can only have one material.

So in Blender if you have multiples materials on one mesh, it is automatically split into multiple parts.


ok, thank you very much