First of all, thank you for your messages. They have been really helpful and informative. I’m trying out something experimental here. I’ve developed a model loader with the goal to dynamically load and set all contents through a JSON. From the information I’ve gathered from you and my own research, I’ve realized that this task is quite complex. It definitely needs to be set up properly. Still, I have the energy for this; I think the model needs to be simplified, perhaps even stripped down to the basics.
Example model source.
const tableResource = {
"type": "gltf",
"path": "/assets/models/table.glb",
"options": {
"scale": [900, 900, 900]
},
"instances": {
"meshes": [
{
"originalName": "left_leg",
"clones": [
{
"cloneName": "right_leg",
"options": {
"position": { x: 7.5 }
}
}
]
},
{
"originalName": "corner",
"clones": [
{
"cloneName": "corner_left_back",
"options": {
"position": { x: 11 }
}
},
{
"cloneName": "corner_right_back",
"options": {
"position": { x: 11, z: 1.3 }
}
},
{
"cloneName": "corner_left_back",
"options": {
"position": { z: 1.3 }
}
}
]
}
]
},
"materials": [
{
"appliedTo": ["top002", "leaf"],
"settings": {
"envMapIntensity": 1,
"displacementScale": 0.02,
"roughness": 1,
"metalness": 0
},
"textures": [
{
"type": "color",
"path": "/assets/texture/table2/wood_table_worn_diff_4k.jpg"
},
{
"type": "displacement",
"path": "/assets/texture/table2/wood_table_worn_disp_4k.png"
}
]
},
{
"appliedTo": ["left_leg", "corner"],
"settings": {
"envMapIntensity": 0.5,
"displacementScale": 0.02,
"roughness": 0.6,
"metalness": 0
},
"textures": [
{
"type": "color",
"path": "/assets/texture/handler/MetalCladdingFrame002_COL_1K.jpg"
},
{
"type": "displacement",
"path": "/assets/texture/handler/MetalCladdingFrame002_DISP_1K.jpg"
},
{
"type": "roughness",
"path": "/assets/texture/handler/MetalCladdingFrame002_GLOSS_1K.jpg"
},
{
"type": "normal",
"path": "/assets/texture/handler/MetalCladdingFrame002_NRM_1K.png"
},
{
"type": "metallic",
"path": "/assets/texture/handler/MetalCladdingFrame002_REFL_1K.jpg"
}
]
}
]
}