Help with Lighting Controls

Hi ! I am just starting out on using Three.js , i have been working on importing a 3D .OBJ model and rendering it using the Chrome browser. I have managed to successfully import the 3D model and render it but i have having issues with its appearance. I am trying to render the model exactly how i found it on but my model appears grey whereas the original model is white. In addition, parts of the model appear white whereas in the original model on the website appears black(not sure if there is an an issue with the downloaded model) or some parts are hazy and appear true to form when i zoom in. My understanding is that i am messing up with the Lighting Controls, i would like to understand how do i manipulate the lights for each model ? How does one decide which light is appropriate and its position?

Please find below , the code i have been working with

 var scene = new THREE.Scene();

 var camera = new THREE.PerspectiveCamera(5, window.innerWidth/window.innerHeight, 0.1, 1000 

camera.position.y = 300;

camera.position.z = -2;

var renderer = new THREE.WebGLRenderer({antialias:true});

renderer.setSize( window.innerWidth, window.innerHeight );


document.body.appendChild( renderer.domElement );

window.addEventListener('resize', ()=>{

renderer.setSize( window.innerWidth, window.innerHeight );

camera.aspect = window.innerWidth/window.innerHeight;



var controls = new THREE.OrbitControls(camera, renderer.domElement);

 controls.enableDamping = true;

 controls.dampingFactor = 0.25;

 controls.enableZoom = true;

 var ambient = new THREE.AmbientLight(0x404040, 2.0);


  var keyLight = new THREE.DirectionalLight('0x404040', 1.0);

  keyLight.position.set(-100, 0, 100);

  keyLight.castShadow= true;

  var fillLight = new THREE.DirectionalLight('0x404040', 1.0);

  fillLight.position.set(100, 0, 100);

  var backLight = new THREE.DirectionalLight(0x404040, 1.0);

  backLight.position.set(100, 0, -100).normalize();




    var mtlLoader = new THREE.MTLLoader();



    mtlLoader.load('Controller.mtl', function (materials) {


    var objLoader = new THREE.OBJLoader();



    objLoader.load('Controller.obj', function (object) {

     object.position.y -= 1;



var animate = function () {

requestAnimationFrame( animate );


renderer.render(scene, camera);

} ;


The model i am tried exporting is
Would i get better results if i used .glTF models ?

There is not right or wrong approach since putting lights into a scene is always an artistic choice. However, there are a few things to keep in mind:

  • The screenshot on probably was produced with a different rendering engine than three.js. Since material and lighting implementations usually vary from engine to engine, it’s often hard to replicate exact visual results.
  • It seems there are two issue in your code: Adding an ambient light with an intensity value of 2 is normally way too high. Try it with a value smaller value like 0.4. Besides, '0x404040' is no valid argument for colors since it’s a wrong string representation. It should be '#404040' or just 0x404040 (a number).
  • And yes, if you have the possibility always use glTF instead of OBJ.

Thank you Mugen87 ! I also see some parts of the imported 3D model not rendering correctly (that is slightly hazy ) which goes away when i zoom in, into the model. Is this an issue with the model or is this because of the way i have placed the camera in my scene ?

It could be related to the camera settings. Do you see any difference when you increase the far plane value (to 5000)?

No. I didn’t see a difference on changing the value to 5000.