Pab144 Posted September 4, 2017 Share Posted September 4, 2017 Hey guys, Love babylonjs, been using it to create arch-viz products and it's great. My questions is: I'm exporting from 3dsmax a scene that contains 4 specific house models each with specific materials, then I instanced the houses all over the map and changed the material on specific houses according to their location relative to my sunlight(directional light). I did this so that I could use different ambient maps for the different houses. My issue is that all the instances are exported with the same material even though some have a different material, example ; I want the mesh for House-South-1 to have material of House-South-1, and House-North-1 to have material House-North-1, but all the instances of the mesh are exported with the same material. Thanks, Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 5, 2017 Share Posted September 5, 2017 Hello! you have to clone them and not instance them. In babylon.js instances are pretty fast but are forced to share the same material Quote Link to comment Share on other sites More sharing options...
RedMax Posted September 5, 2017 Share Posted September 5, 2017 We have the same or a similar problem here. And in 3ds those are not instances, but completely independant meshes with their own textures. Once we try to export them, only one material will get exported and all the meshes will have this material. Where could the problem be located? Quote Link to comment Share on other sites More sharing options...
Pab144 Posted September 5, 2017 Author Share Posted September 5, 2017 Okay, so I followed @Deltakosh advice and did the following to get it to work. They key is to have a UNIQUE copy of the mesh you are going to instance for each different material, so if you have Mesh-1(UNIQUE) and apply Material-1 you can then instance this mesh as many times as needed, as long as the instances are being made from a UNIQUE copy of the original mesh you should be able to have for example 4 meshes that are exact copies or clones of each other with different materials and then instance those copies with their different materials being preserved at export time. It worked for me. I hope it helps @RedMax . Quote Link to comment Share on other sites More sharing options...
RedMax Posted September 6, 2017 Share Posted September 6, 2017 I also got it working But for me the solution was to create a new material from scratch. Before, the material was just copy&pasted from some other material and I don't know why, but in this case, the export had the same ID on both of the materials. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.