# Help Loading a 3D Model (.obj)

**URL:** <https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887>\
**Category:** Questions\
**Tags:** getting-started\
**Created:** [January 27, 2021, 5:36pm UTC](https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887 "2021-01-27T17:36:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Larson](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jack_larson/32/15951_2.png) [@Jack\_Larson](https://discourse.threejs.org/u/Jack_Larson)\
**Post date:** [January 27, 2021, 5:36pm UTC](https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887/1 "2021-01-27T17:36:03Z")

</div>

I am very new to Three.js and new to JavaScript in general, and I am having trouble loading a 3D model. The model is .obj and the console is not throwing any errors, the model just does not appear. Here is my code:

```javascript
import * as THREE from '/three/build/three.module.js';
import { OBJLoader } from '/three/examples/jsm/loaders/OBJLoader.js';

let camera, scene, renderer;
let geometry, material, mesh;

init();

function init() {
  camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 100000);
  camera.position.z = -1000;
  scene = new THREE.Scene();

  const loader = new OBJLoader();

  loader.load(
    // resource URL
    '/models/earth.obj',
    // called when resource is loaded
    function ( object ) {

      scene.add( object );

    },
    // called when loading is in progresses
    function ( xhr ) {

      console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

    },
    // called when loading has errors
    function ( error ) {

      console.log( 'An error happened' );

    }
  );
  

  renderer = new THREE.WebGLRenderer( {antialias: true} );
  renderer.setSize( window.innerWidth, window.innerHeight );
  renderer.setAnimationLoop( animation );
  document.body.appendChild ( renderer.domElement );
}

function animation(time) {

  renderer.render( scene, camera );
}

```

---

<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:** [January 27, 2021, 5:41pm UTC](https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887/2 "2021-01-27T17:41:19Z")

</div>

Try to add some lights to your scene. E.g.

```javascript
const ambientLight = new THREE.AmbientLight( 0xcccccc, 0.4 );
scene.add( ambientLight );

const pointLight = new THREE.PointLight( 0xffffff, 0.8 );
scene.add( pointLight );

```

---

<div class="post-metadata">

**Author:** ![Jack\_Larson](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jack_larson/32/15951_2.png) [@Jack\_Larson](https://discourse.threejs.org/u/Jack_Larson)\
**Post date:** [January 27, 2021, 5:43pm UTC](https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887/3 "2021-01-27T17:43:55Z")

</div>

Thank you so much! Works now.

---

<div class="post-metadata">

**Author:** ![hofk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hofk/32/44944_2.png) [@hofk](https://discourse.threejs.org/u/hofk)\
**Post date:** [January 27, 2021, 5:46pm UTC](https://discourse.threejs.org/t/help-loading-a-3d-model-obj/22887/4 "2021-01-27T17:46:16Z")

</div>

> [@Jack\_Larson](#):
>
> am very new to Three.js and new to JavaScript in general, and I am having trouble loading a 3D model. The model is .obj and the console is not throwing any errors, the model just does not appear.

See [LoadOBJbyModule](https://hofk.de/main/discourse.threejs/2021/LoadOBJbyModule/LoadOBJbyModule.html)  
from the

> [@Collection of examples from discourse.threejs.org](https://discourse.threejs.org/t/collection-of-examples-from-discourse-threejs-org/4315):
>
> The answers to some questions contain some very interesting and instructive basic examples. These are difficult to find in the large number of questions on discourse.There are also good examples in resources and showcase. Therefore I collected them and put them on one page, clearly arranged by time. The collection may be a help for beginners. slightly_smiling_face UPDATE 2019 [http://discourse.threejs.hofk.de/](http://discourse.threejs.hofk.de/) is now redirected to the safe side [\* discourse.threejs.hofk.de](https://hofk.de/main/discourse.threejs/) UPDATE 202…
