# Three.js load gltf

**URL:** <https://discourse.threejs.org/t/three-js-load-gltf/21290>\
**Category:** Questions\
**Tags:** gltf-loader\
**Created:** [December 6, 2020, 10:23am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290 "2020-12-06T10:23:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lighty](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lighty/32/43283_2.png) [@Lighty](https://discourse.threejs.org/u/Lighty)\
**Post date:** [December 6, 2020, 10:23am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/1 "2020-12-06T10:23:40Z")

</div>

Hello.  
I save the file from the blender in the format gltf.

 ![0](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/8/8d6e68dccafc94158e0b26e40a1094cd696b5bc7.jpeg)

upload to the project  
[https://codepen.io/Lighty/pen/MWePVNz](https://codepen.io/Lighty/pen/MWePVNz)  
nothing is displayed in the project  
but if i upload the same file to tree.js editor  
i see this object

 ![1](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/a/a809624c2f658cea45cc20a9b8bfd7533bb90998.jpeg)

can explain what the problem is?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [December 6, 2020, 10:39am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/2 "2020-12-06T10:39:28Z")

</div>

I have seen this many times and I’m not sure why users are doing this. But you should never do this:

```javascript
mesh = gltf.scene.children[0];

```

It _might_ work but not in all cases. Your glTF contains three 3D objects and you are currently selecting not the mesh. To avoid such issues, it’s best to do this:

```javascript
mesh = gltf.scene;

```

In Blender, you should also ensure to only export objects you actually want. I guess it is not your intention to export the camera and light, right?

---

<div class="post-metadata">

**Author:** ![Lighty](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lighty/32/43283_2.png) [@Lighty](https://discourse.threejs.org/u/Lighty)\
**Post date:** [December 6, 2020, 10:43am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/3 "2020-12-06T10:43:15Z")

</div>

yes right. but I also tried to export the light, it didn’t have any effect)))

---

<div class="post-metadata">

**Author:** ![Lighty](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lighty/32/43283_2.png) [@Lighty](https://discourse.threejs.org/u/Lighty)\
**Post date:** [December 6, 2020, 10:45am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/4 "2020-12-06T10:45:27Z")

</div>

thanks for the answer.  
I also wanted to ask if it is possible for objects that have no textures and no color to set the color using three.js ?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [December 6, 2020, 10:45am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/5 "2020-12-06T10:45:59Z")

</div>

> [@Lighty](#):
>
> but I also tried to export the light, it didn’t have any effect

You have to enable the export of punctual lights in the `Include` section:

![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/7/7af67e5f6e74a63004eeac0b5e323441cb40f1c1.png)

> [@Lighty](#):
>
> I also wanted to ask if it is possible for objects that have no textures and no color to set the color using three.js ?

In this case, it’s best if you just overwrite the asset’s materials in your app.

---

<div class="post-metadata">

**Author:** ![Lighty](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lighty/32/43283_2.png) [@Lighty](https://discourse.threejs.org/u/Lighty)\
**Post date:** [December 6, 2020, 10:52am UTC](https://discourse.threejs.org/t/three-js-load-gltf/21290/6 "2020-12-06T10:52:21Z")

</div>

> [@Mugen87](#):
>
> n this case, it’s best if you just overwrite the material in you app.

but asset materials are set only in blender?
