the only part of code which contains something with render setting or light is here ( i dont know if it help ) :all the scene except light is coming from blender .
const renderer = new THREE.WebGLRenderer();
renderer.gammaOutput = true;
renderer.gammaFactor = 2.2;
// console.log(renderer.info);
// console.log(renderer.capabilities);
renderer.shadowMap.enabled=true;
renderer.shadowMap.type=THREE.PCFSoftShadowMap;
renderer.antialias=true;
renderer.setSize( window.innerWidth, window.innerHeight );
/******** set camera ********/
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 30000 );
camera.position.z=170;
camera.position.x=1486;
camera.position.y=-820;
camera.up = new THREE.Vector3(0,0,1);
camera.lookAt(1458,-781,170);
var lumiere = new THREE.DirectionalLight(0xffffff,1);
lumiere.castShadow = false ;
scene.add(lumiere.target);
lumiere.target.position.set(0,0,160);
scene.add(lumiere);
lumiere.visible = false ;
lumiere.position.set(0,0,1);
var lumiereHelper = new THREE.DirectionalLightHelper(lumiere,5000);
scene.add(lumiereHelper);
/*************/
var lumiereOmbre = new THREE.DirectionalLight(0xffffff,1);
lumiereOmbre.castShadow=true;
lumiereOmbre.shadow.mapSize.width=2048;
lumiereOmbre.shadow.mapSize.height=2048;
lumiereOmbre.shadow.camera.near=1;
lumiereOmbre.shadow.camera.far=1000;
lumiereOmbre.shadow.camera.left = -200;
lumiereOmbre.shadow.camera.bottom = -150;
lumiereOmbre.shadow.camera.top = 150;
lumiereOmbre.shadow.camera.right = 200;
lumiereOmbre.shadow.camera.DefaultUp= new THREE.Vector3(0,0,1);
lumiereOmbre.position.set(0,0,1);
scene.add(lumiereOmbre);
lumiereOmbre.DefaultUp= new THREE.Vector3(0,0,1);
lumiereOmbre.visible = false ;
scene.add(lumiereOmbre.target);
var lumiereOmbreHelper = new THREE.DirectionalLightHelper(lumiereOmbre,400);
scene.add(lumiereOmbreHelper);
lumiereOmbreHelper.DefaultUp= new THREE.Vector3(0,0,1);
var cameraHelper = new THREE.CameraHelper(lumiereOmbre.shadow.camera);
scene.add(cameraHelper);
lumiereHelper.visible = false;
lumiereOmbreHelper.visible = false ;
cameraHelper.visible = false ;
/*****************************/
var lumiere3=new THREE.AmbientLight(0xffffff,0.1);
scene.add(lumiere3);
sun.init();
entre.set(0,0,0);
camSol.set(camera.position.x,camera.position.y,160 );
entre.addScaledVector( new THREE.Vector3( lumiere.position.x-camera.position.x ,
lumiere.position.y-camera.position.y ,
lumiere.position.z-160 ) , 0.1);
lumiere.position.set(sun.getX() , sun.getY() ,sun.getZ());
entre.addVectors(entre,camSol);
lumiereOmbre.position.set(entre.x,entre.y,entre.z);
lumiereOmbre.target.position.set(camera.position.x,camera.position.y,160);
lumiere.target.position.set(camera.position.x,camera.position.y,160);
soleil_jaune.position.set(sun.getX() , sun.getY() ,sun.getZ()) ;
if ( sun.getZ() <160 && sun.getZ() >-640 ) {
lumiere.visible = true;
lumiereOmbre.visible = true ;
soleil_jaune.visible=true ;
// soleil_rouge.visible = false ;
let intensite= 1 - ( 160 - sun.getZ())/800 ;
lumiere.intensity = intensite*0.25;
scene.background.r = 0.133+0.53 * intensite;
scene.background.g = 0.133+0.53 * intensite;
scene.background.b = 0.2+ 0.8*intensite;
lumiereOmbre.intensity= intensite ;
soleil_jaune.material.color.r = 0.2+0.8*intensite;
soleil_jaune.material.color.g = 0.2+0.8*intensite;
soleil_jaune.material.color.b = 0.133+0.53*intensite;
lumiere3.intensity = 0.05+ 0.2*intensite ;
}
if ( sun.getZ() < -640 ) { lumiere.visible=true;
lumiereOmbre.visible=true;
soleil_jaune.visible=false;
lumiere.intensity = 0 ;
scene.background.r = 0.133;
scene.background.g = 0.133;
scene.background.b = 0.2;
lumiereOmbre.intensity= 0 ;
// soleil_jaune.intensity = 0 ;
lumiere3.intensity = 0.05 ;
}
if (sun.getZ() > 160 ){
lumiere.visible=true;
lumiereOmbre.visible= true;
soleil_jaune.visible=true;
lumiere.intensity=0.25;
scene.background.r = 0.666 ;
scene.background.g = 0.666 ;
scene.background.b = 1;
lumiereOmbre.intensity= 1 ;
soleil_jaune.material.color.r = 1;
soleil_jaune.material.color.g = 1;
soleil_jaune.material.color.b = 0.666;
lumiere3.intensity =0.25;
}