Adding material from .mtl file to a custom mesh

Continuing this :
https://playground.babylonjs.com/#B6XF7C#5
I have a material file from which I wish to import the material for the hat in the above playground. Is this possible?

You should be able to use the MTLFileLoader class: MTLFileLoader - Babylon.js Documentation

1 Like

@Evgeni_Popov thanks! I looked into the playground examples and found this https://www.babylonjs-playground.com/#0SHBCK#12

Is there a method to maybe avoid making jquery calls again and again. Given that the data inside the mtl file stays the same.

okay solved it. The extracted data can be stored as a strinh in the js file itself. Pretty cool. Thanks @Evgeni_Popov

1 Like