Hi~
when I want to render industry model in babylonjs, I have some troubles:
thousands of models.
thousands of materials.
Usually, we collect similar material to decrease number of materials, we combine mesh with same material. In this way, we can’t move model and can not change material parameters.
I create a new mesh combine tool to combine the industry model:
Model can be moved
Model meshColor
Model visible
Material can be changed (only value type, can’t change texture)
You can test it in GitHub - Moriyer/BabylonjsDemo at master
Some trouble with my network, I can’t push code to github, newest version will push as soon as my network fixed.
Didn’t find the exact place where the mesh created yet, but in shader code I found a uv4 used as some sort of pre-vertex simulation of gl_DrawID. Might worth a try when WEBGL_multi_draw is available, or wait for more powerful and performant MDI in next few years (might be quite a few)
Combining meshes is a huge work, which is often make web crashed with weakness computer. My plan is combine mesh and export fixed glb file in a headless-web service, and only load and preview fixed model in user web-chrome. Because of I don’t sure could glb exporter export custom attributes, I use uv4 to store meshID and materialID. It just has a try to make old and weakness computer to preview large models.