# \[SOLVED\] What's the best file format for importing models into playcanvas?

**URL:** <https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557>\
**Category:** Help & Support\
**Created:** [August 27, 2020, 8:50am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557 "2020-08-27T08:50:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamer\_Wael](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/gamer_wael/32/14870_2.png) [@Gamer\_Wael](https://forum.playcanvas.com/u/Gamer_Wael)\
**Post date:** [August 27, 2020, 8:50am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/1 "2020-08-27T08:50:42Z")

</div>

Is there any difference in performance/browser compatibility depending on whether I use glTF, obj or USDZ? If not, which is your personal preference?

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 8:54am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/2 "2020-08-27T08:54:15Z")

</div>

USDZ is a Safari native model format. AFAIK, PlayCanvas doesn’t support it.

gLTF is the accepted runtime model and scene standard across most WebGL engines now.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 9:46am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/3 "2020-08-27T09:46:05Z")

</div>

Oh, forgot to say that glTF import into the editor is not fully supported yet (you have to load at runtime)

FBX is still the best choice to import models and animations into PlayCanvas Editor

---

<div class="post-metadata">

**Author:** ![Gamer\_Wael](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/gamer_wael/32/14870_2.png) [@Gamer\_Wael](https://forum.playcanvas.com/u/Gamer_Wael)\
**Post date:** [August 27, 2020, 9:58am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/4 "2020-08-27T09:58:49Z")

</div>

Thanks for the clarification because in the GitHub examples I couldn’t find how to load glTF so I was confused.

---

<div class="post-metadata">

**Author:** ![Gamer\_Wael](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/gamer_wael/32/14870_2.png) [@Gamer\_Wael](https://forum.playcanvas.com/u/Gamer_Wael)\
**Post date:** [August 27, 2020, 10:30am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/5 "2020-08-27T10:30:11Z")

</div>

However there are only two examples, for loading glb and obj, but not for fbx…

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [August 27, 2020, 10:35am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/6 "2020-08-27T10:35:18Z")

</div>

Hi @Gamer_Wael,

For FBX you don’t have to do anything special, just drag and drop it in editor, on the assets panel.

And it will get converted automatically to a model asset which you can easily drag and drop in scene.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 10:43am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/7 "2020-08-27T10:43:04Z")

</div>

> [@Gamer\_Wael](#):
>
> However there are only two examples, for loading glb and obj, but not for fbx…

GLB is the binary container format for glTF. It not only holds the model data, it can also contain materials, animations, cameras etc. Most 3D tools will export out to GLB. Most of the GitHub examples that have a model, is likely to be loading a GLB.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 10:45am UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/8 "2020-08-27T10:45:34Z")

</div>

For completeness, here is an example of loading a glTF file:  
Scene: [https://playcanvas.com/editor/scene/849686](https://playcanvas.com/editor/scene/849686)  
Code: [https://playcanvas.com/editor/code/655732?tabs=26279043](https://playcanvas.com/editor/code/655732?tabs=26279043)

---

<div class="post-metadata">

**Author:** ![Gamer\_Wael](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/gamer_wael/32/14870_2.png) [@Gamer\_Wael](https://forum.playcanvas.com/u/Gamer_Wael)\
**Post date:** [August 27, 2020, 3:56pm UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/9 "2020-08-27T15:56:59Z")

</div>

Ok so I’m still having trouble with this. I’ve imported my obj model but it looks like there’s no way to import the mtl file. I converted it into glb and tried importing that but it didn’t work. I did it like this:

```
    var url = "./Tambourine.glb";
    app.assets.loadFromUrl(url, "container", function (err, asset) {

        var entity = new pc.Entity();
        entity.addComponent("model", {
            type: "asset",
            asset: asset.resource.model,
            castShadows: true
        });
        app.root.addChild(entity);
    });

```

But I got an error: Cannot read property ‘resource’ of undefined.

What’s the best way to programmatically import a model along with textures?

> [@Leonidas](#):
>
> For FBX you don’t have to do anything special, just drag and drop it in editor, on the assets panel.

I’m trying to make this project without the editor. I know I’m just making it unnecessarily difficult for myself, but I’d like to complete this without using the editor.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 4:16pm UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/10 "2020-08-27T16:16:29Z")

</div>

It’s a bit difficult to debug without a reproducible. Can you create a JSFiddle version of this? Or upload the build somewhere we can take a look please?

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [August 27, 2020, 4:18pm UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/11 "2020-08-27T16:18:02Z")

</div>

> [@Gamer\_Wael](#):
>
> I’m trying to make this project without the editor. I know I’m just making it unnecessarily difficult for myself, but I’d like to complete this without using the editor.

Right, with the engine you can only load FBX files directly.

You will have to upload them in the editor, and download the converted to .json model. That file can be loaded by the engine then.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [August 27, 2020, 4:18pm UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/12 "2020-08-27T16:18:58Z")

</div>

> [@Gamer\_Wael](#):
>
> What’s the best way to programmatically import a model along with textures?

The best way is GLB. You can test the GLB model you exported using our viewer tool:

> **[Model Viewer](https://playcanvas.com/viewer)**
>
> Fast and lightweight glTF 2.0 and gaussian splatting PLY viewer powered by the PlayCanvas engine.

---

<div class="post-metadata">

**Author:** ![Gamer\_Wael](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/gamer_wael/32/14870_2.png) [@Gamer\_Wael](https://forum.playcanvas.com/u/Gamer_Wael)\
**Post date:** [August 27, 2020, 5:50pm UTC](https://forum.playcanvas.com/t/solved-whats-the-best-file-format-for-importing-models-into-playcanvas/14557/13 "2020-08-27T17:50:58Z")

</div>

Thanks a lot for the help. It turns out I was using an older version of playcanvas saved on my device. I have now updated to latest stable version and that fixed the issue.
