In that thread I did post a code solution that made sure the scene always only had one version of a same named material. Basically on every asset load I run this function , the function in a nut shell :
• all materials of loaded asset are evaluated
• if a material with name x is not found in cache , it is cached.
• if a material with name x is found , The duplicate is flagged for deletion and replaced with the cached material
• once recursion of nodes is complete all flagged duplicates are deleted properly.
I wrote this a while back and have not visited the code again. It is possible it could be optimized , refactored or done different. At the time it worked a treat
Currently im working on a complex Laravel and VUE project and have not touched babylon development for months.
Some clever developer should think of making something with this logic part of the native engine code , I mean this kind of material duplication is a problem in other applications as well ( blender im looking at you , i have a python snippet to get rid of those as well )