zadders
zadders

Reputation: 438

Emissive light source does not affect shading of other objects Three.js

I'm working on a solar system project that involves planets and a rocketship orbiting around a sun. There is currently a main light source with the code being as follows

// add subtle ambient lighting
var ambientLight = new THREE.AmbientLight(0x0c0c0c);
scene.add(ambientLight);

// add spotlight for the shadows
var spotLight = new THREE.PointLight(0xffffff);
spotLight.position.set(-200, 50, 150);
spotLight.castShadow = true;
scene.add(spotLight);

I have created a sun object and tried giving it an emissive property so that it can shine light at other planets too. Although it seems to make the planet glow in a sense, it's more of just the object lighting up and not having shading rather than actually becoming a light source. The code for the sun object is as follows

 function createSunMesh(geom) {
     var loader = new THREE.TextureLoader();
     var planetSunTexture = loader.load("../assets/textures/planets/sun.jpg");
     //var normalSunTexture = loader.load("../assets/textures/planets/moonbump.jpg");

     var planetSunMaterial = new THREE.MeshLambertMaterial({map: planetSunTexture, emissive: 0xac3d25});
     //bumpMap: normalMoonTexture

     // create a multimaterial
     var planetSunMesh = THREE.SceneUtils.createMultiMaterialObject(geom, [planetSunMaterial]);
     planetSunMesh.visible = false;

     return planetSunMesh;
 }

So my question is, is there a way to make the emissive property of the light stronger / strong enough to impact the other objects? I have tried using both Lambert / Phong materials but they seem to have the same effect as one another.

Upvotes: 0

Views: 497

Answers (1)

zadders
zadders

Reputation: 438

I ended up repositioning the main spotlight so it was within my sun object, which gave it the same effect that I was looking for. Also, I increased the intensity and reduced the decay to give the light a more realistic effect

Upvotes: 1

Related Questions