# Adding material from .mtl file to a custom mesh

**URL:** <https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425>\
**Category:** Questions\
**Tags:** material\
**Created:** [September 25, 2020, 7:03am UTC](https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425 "2020-09-25T07:03:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 25, 2020, 7:03am UTC](https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425/1 "2020-09-25T07:03:31Z")

</div>

Continuing this :  
[https://playground.babylonjs.com/#B6XF7C#5](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?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [September 25, 2020, 9:21am UTC](https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425/2 "2020-09-25T09:21:17Z")

</div>

You should be able to use the MTLFileLoader class: [MTLFileLoader - Babylon.js Documentation](https://doc.babylonjs.com/api/classes/babylon.mtlfileloader)

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 25, 2020, 7:26pm UTC](https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425/3 "2020-09-25T19:26:44Z")

</div>

@Evgeni_Popov thanks! I looked into the playground examples and found this [https://www.babylonjs-playground.com/#0SHBCK#12](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.

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 25, 2020, 7:31pm UTC](https://forum.babylonjs.com/t/adding-material-from-mtl-file-to-a-custom-mesh/14425/4 "2020-09-25T19:31:55Z")

</div>

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