Custom GlTF Exporter Behavior

Hello,

I am currently working on upgrading my WebGL app from BABYLON 6.3 to BABYLON 7.9.

While the transition is smooth in many ways for the rendering, adapting the exporter is quite a pain.

We modified the exporter in order to be able to transfer a GLB file containing empty geometry nodes in place of 3D models, then upload it to a server, and server-side, our solution is able to fill these empty nodes by downloading the corresponding geometry data as separate GLB files. That allows us to make the export lighter for the client, and make the uploading way faster.

We implemented this feature a few years ago in quite a hacky way, by extending the exporter object, duplicating functions, and modifying these functions. Obviously, upgrading BABYLON becomes harder every time, since the exporter works as kind of a black box.

I would like to implement “handles” in the exporter code(in the same way as the “shouldExportNode” function for example) in order to add a cleaner way to customize exporter functions. Thus, if someone has specific needs for the exporter, they can just create their own “customExportBehavior” function which will be applied.

At each node export, the function would be called if it exists, otherwise the default behavior would be called.

What do you think about it?

Thanks in advance! :slight_smile:

2 Likes

That’s a very interesting suggestion!

It will require some work to get it done, and i’ll be honest and say - I am not sure it will be done any time soon, unless someone from the community is willing to take that as a task, but I really like the suggestion. It makes perfect sense to me - have default implementation (what we have), but allow overriding this if you need something special.

I can totally get how upgrading to a new version might be a hassle for you. This is sadly not part of our back-compat guaranty - if you “hack” your way (and I don’t mean that as something negative!), we can’t promise it will work the next version.

1 Like

Great to have a positive feedback!

It is normal for you to not be able to guarantee back-compat for every hack that could be done on top of your code haha

My team and I will take the subject then, since we need it!

Thanks!