# Loading any GLTF wont load

**URL:** <https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693>\
**Category:** Questions\
**Tags:** gltf-loader, getting-started\
**Created:** [March 22, 2020, 10:46am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693 "2020-03-22T10:46:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 10:46am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/1 "2020-03-22T10:46:55Z")

</div>

I am unable to load any Gltf file, I tried everything.  
[This is my test link](https://eloquent-khorana-6c9ec2.netlify.com/)  
It says infinity% loaded but it is not loaded…  
Can you help me out!  
Thanks!

---

<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:** [March 22, 2020, 10:51am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/2 "2020-03-22T10:51:51Z")

</div>

`xhr.total` is always `0` in your app because of the following reason:

> <https://stackoverflow.com/questions/27767954/xmlhttprequest-onprogress-total-is-always-0-on-chrome>

Dividing a number though zero produces `Infinity`.

Besides, I suggest you add some lights to your scene, otherwise you won’t be able to see the model (which is actually fine, validate via [https://gltf-viewer.donmccurdy.com/](https://gltf-viewer.donmccurdy.com/)).

---

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 10:56am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/3 "2020-03-22T10:56:49Z")

</div>

Thanks for your help, I really appreciate it!  
but, I just added a light and I am still unable to see any object…

---

<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:** [March 22, 2020, 11:00am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/4 "2020-03-22T11:00:40Z")

</div>

Do you see the shape of the model when adding a white background like so:

```auto
scene.background = new THREE.Color( 0xffffff );

```

---

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 11:02am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/5 "2020-03-22T11:02:55Z")

</div>

I entered the code, but my background is still black.

---

<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:** [March 22, 2020, 11:04am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/6 "2020-03-22T11:04:22Z")

</div>

Try to call `animate()`. Right now, you are not animating your scene.

---

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 11:08am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/8 "2020-03-22T11:08:33Z")

</div>

Do I need to make an animation loop?

---

<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:** [March 22, 2020, 11:10am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/9 "2020-03-22T11:10:45Z")

</div>

Well, you have to render your scene at least once after the `glTF` asset has been loaded and when you interact with the scene (e.g. change the camera). Read this for more information:

> [@Poor performance and different rendering on mobile](https://discourse.threejs.org/t/poor-performance-and-different-rendering-on-mobile/13643/2):
>
> I’m not sure but it seems you are mixing an animation loop with on-demand rendering. For viewer software, it’s usually best to render only when the scene has changed (except for the case the model has animations). Hence, I suggest you remove the animation loop. If you want to keep it because of the control’s damping, I recommend you remove the call of: controls.addEventListener( 'change', render ); Since you already have an animation loop, rendering on demand is not necessary. Otherwise you…

---

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 11:14am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/10 "2020-03-22T11:14:43Z")

</div>

I deleted the loop, and my canvas is white, but now I still do not see the car.  
edit: right now I added: ` setTimout(renderLooping, 1000) function renderLooping(){ setTimout(renderLooping, 1000) renderer.render( scene, camera ); } `  
So every second the canvas is updated.

---

<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:** [March 22, 2020, 11:20am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/11 "2020-03-22T11:20:23Z")

</div>

Your code produces a runtime error:

> Uncaught ReferenceError: setTimout is not defined

There is a typo in your function call.

I suggest you make yourself a bit more familiar with JavaScript and the basics of `three.js`. All your questions in this thread will be then automatically be answered.

---

<div class="post-metadata">

**Author:** ![Jelger](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jelger/32/9944_2.png) [@Jelger](https://discourse.threejs.org/u/Jelger)\
**Post date:** [March 22, 2020, 11:21am UTC](https://discourse.threejs.org/t/loading-any-gltf-wont-load/13693/12 "2020-03-22T11:21:20Z")

</div>

Yeah i just noticed, oops.  
Thanks for your help, i really appreciate it, and i learned alot!
