Closed TechAspirant closed 2 years ago
hmm... which number do you get, and which number do you expect?
Notice that there's Logical Nodes and Visual Nodes
model.LogicalNodes
is the flattened list of nodes as they're stored within the model, regardless of whether they're being used in a scene or not.
model.DefaultScene.VisualChildren
is the nodes actually visible in the scene.
I am getting logical node count as 4. But If I see in sandbox provided by babylon I can see some child nodes which are misssing when I read from the SharpGLTF.
These doesn't look like nodes, they seem to be Mesh Primitives, which are contained within a Mesh in LogicalMeshes
Other files are loaded correctly. Except the shared one. Logical Meshes count is only 2. I am looking for all children in 'TestFuerJochen' Node.
The "optima" model you attached only has 4 logical nodes inside, this is the relevant section of the code:
"nodes": [
{
"name": "Cube",
"mesh": 0
},
{
"name": "Light",
"rotation": [
0.169075757,
0.755880356,
-0.272171378,
0.570947528
],
"translation": [
4.07624531,
5.903862,
-1.00545394
]
},
{
"name": "Camera",
"rotation": [
0.483536035,
0.336871594,
-0.208703607,
0.780482709
],
"translation": [
7.35889149,
4.95830917,
6.92579079
]
},
{
"name": "TestFuerJochen",
"mesh": 1,
"rotation": [
0.707106829,
0,
0,
0.707106709
]
}
]
It defines TWO meshes, which might be located in LogicalMeshes
"meshes": [
{
"name": "Cube",
"primitives": [
{
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"indices": 3,
"material": 0
}
]
},
{
"name": "TestFuerJochen",
"primitives": [
{
"attributes": {
"POSITION": 4,
"NORMAL": 5
},
"indices": 6,
"material": 1
},
{
"attributes": {
"POSITION": 7,
"NORMAL": 8
},
"indices": 9,
"material": 2
},
{
"attributes": {
"POSITION": 10,
"NORMAL": 11
},
"indices": 12,
"material": 3
},
{
"attributes": {
"POSITION": 13,
"NORMAL": 14
},
"indices": 15,
"material": 4
},
,
,
,
,
,
So the first mesh is just a cube, and the SECOND MESH, has +200 primitices, which is where all the geometry "nodes" are located.
Whats the primitive name in this case ? Does that mean I have to check that a mesh contains primitive or not and If it does read the primitive information as well.
Yes, mesh primitives is where the geometry is stored
Do primitive follow a naming convention Say MeshName_Primitive
No, primitives are just rendering batches within a mesh
If so than why it gets highlighted as a specific part in the babylon sandbox ?
Why Babylon chose to display the data in the way they did is a question for Babylon.
What I do know is the GLB model you attached has 4 nodes and 2 meshes, and the 2nd mesh has +200 primitives
Hello,
In my case the glb file is showing incorrect number of logical nodes. But its rightly loaded in babylonjs sandbox. Below is the link of glb file and code for reference https://nsimagefolder.s3.us-east-2.amazonaws.com/optima.glb