Blender&BabylonJS: How do you manage mesh properties?

Hi learned and wise community!

I was just seeking best practices for how people manage mesh properties. By properties, I mean something like a label, description, whether the mesh is interactive or an animation variable. This is going to assume that I’ve named my objects with a unique ID in Blender.

I care about speed of creating objects and changing values. I’m a strong believer in shortening the time it takes to round trip between creating to final view so it frees you up to experiment. Like the playground here. But I’m using Vite and BabylonJS and developing locally (so I don’t have to upload my Blender exports).

1/ Save the Blender scene with glTF exporter and then have a separate JSON file that has all the meshes with extra properties as needed. Running a whole database just for this is too much work for now but using a Google Sheet with a JSON exporter does the job.

Pros

  • All the numbers are in one place in a table so rebalancing or adjusting multiple at once is easy.

Cons

  • Finding something means looking up the ID all the time, when really I want to just be able to click on the object in the scene and adjust it from there.
  • Syncing the list with the latest Blender export is a bit manual. Probably the fastest way is just using Babylon to dump a comma separated string of all the meshes that I can copy and paste into the sheet.
  • Exporting is manual too.

2/ Use the “Custom Properties” area in Blender to add my property there and then save it using the Babylon exporter (I see this was only recently added).

Pros

  • Edit values in place of where the mesh is
  • Properties update on export of the file

Cons

  • No big view of all of these properties to edit in one place or easy to find when one is missing

In the longer run for either option I’d probably use something like AGGrid to give me an interface within the Babylon app to view/edit from (good for having custom dropdowns with complex dependent settings that’s impossible in Google Sheets and even Blender). I know there’s a way to set up the Babylon Inspector too with custom values and if I then had something writing them out (DB or File) so that would really be editing in place.

I guess most of this is a balance between how much setup work is worth it for how much work it’ll save in future.

I’m not sure there are best practices for this. glTF extras field is meant for these kinds of properties (which I think would be option 2), but it’s not perfect. Hopefully someone from the community has experience / thoughts.

3 Likes

Recently in a project I found myself in a similar situation. My options were to work with an XML/JSON file or otherwise include the metadata in the model and export it from 3DsMax

Finally, I chose to work with an XML file in which I indicated (title, description, lightmaps, textures…)
Mainly I didn’t want to export each file again in case I wanted to change or add new textures and generally modify the data.

Likewise, each model was passed through GLTFReport to apply a MeshOpt compression, therefore I wanted to avoid the number of exports.
It all depends on the complexity of the project.
In my case, it certainly helped me optimize the workflow

This is an initial demo of this project:

https://viseni.com/roomdesign2/

4 Likes

Maybe another thing to consider is the KHR_xmp_json_ld extension. If you’ve ever worked with XMP data on an image, this is effectively the equivalent of it for glTF.

4 Likes