Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created July 28, 2020 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/7b84955a8a41cbc749e6fc138c1cd477 to your computer and use it in GitHub Desktop.
Save marshallmurphy/7b84955a8a41cbc749e6fc138c1cd477 to your computer and use it in GitHub Desktop.
//...
// LIGHTING
const light = new THREE.PointLight("white", 1.25);
light.position.set(0, 0, 0);
scene.add(light);
// illuminate the sun
createSpotlights(scene); // call the function and pass in our scene
// HELPERS
// ...
function createPlanet(scene, mesh, group, x, scale) { }
// generate spotlights on all sides like a cube.
function createSpotlights(scene) {
var color = 0xFFFFFF;
var intensity = 5;
var distance = 25;
var angle = Math.PI/7;
new Array(6).fill('').forEach((item, i) => {
var spotlight = new THREE.SpotLight(color, intensity, distance, angle);
var value = i % 2 === 0 ? 25 : -25;
spotlight.position.set(
i < 2 ? value : 0,
i >= 2 && i < 4 ? value : 0,
i >= 4 ? value : 0
);
scene.add( spotlight );
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment