Fix lighting on main star.

This commit is contained in:
2019-03-13 17:02:15 +01:00
parent fe0124c92a
commit 80a8890606

View File

@@ -56,11 +56,11 @@ function addStar() {
backMaterial.side = THREE.BackSide; backMaterial.side = THREE.BackSide;
let star = new THREE.Mesh(frontGeometry, material); let star = new THREE.Mesh(frontGeometry, material);
star.receiveShadow = true; star.castShadow = star.receiveShadow = true;
coreStarGroup.add(star); coreStarGroup.add(star);
let backStar = new THREE.Mesh(backGeometry, backMaterial); let backStar = new THREE.Mesh(backGeometry, backMaterial);
backStar.receiveShadow = true; backStar.castShadow = backStar.receiveShadow = true;
coreStarGroup.add(backStar); coreStarGroup.add(backStar);
let ringGeometry = generateStarRing(2, 3, 0.4); let ringGeometry = generateStarRing(2, 3, 0.4);
@@ -128,8 +128,8 @@ function startOpenAnimation() {
camera.position.z = 5; camera.position.z = 5;
renderer = new THREE.WebGLRenderer({ renderer = new THREE.WebGLRenderer({
antialias: true antialias: true
}); });
renderer.setSize(window.innerWidth, window.innerHeight); renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true; renderer.shadowMap.enabled = true;
renderer.shadowMap.autoUpdate = true; renderer.shadowMap.autoUpdate = true;
@@ -149,15 +149,15 @@ function initLighting() {
let spotLight = new THREE.PointLight(0xffffff); let spotLight = new THREE.PointLight(0xffffff);
spotLight.position.set(10, 10, 10); spotLight.position.set(10, 10, 10);
spotLight.castShadow = true; spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024; // default spotLight.shadow.mapSize.width = 2048; // default
spotLight.shadow.mapSize.height = 1024; // default spotLight.shadow.mapSize.height = 2048; // default
scene.add(spotLight); scene.add(spotLight);
let spotLight2 = new THREE.PointLight(0xffffff, 0.8); let spotLight2 = new THREE.PointLight(0xffffff, 0.8);
spotLight2.position.set(-10, 0, 0); spotLight2.position.set(-10, 0, 0);
spotLight2.castShadow = true; spotLight2.castShadow = true;
spotLight2.shadow.mapSize.width = 1024; // default spotLight2.shadow.mapSize.width = 2048; // default
spotLight2.shadow.mapSize.height = 1024; // default spotLight2.shadow.mapSize.height = 2048; // default
scene.add(spotLight2); scene.add(spotLight2);
let ambient = new THREE.AmbientLight(0x404040); let ambient = new THREE.AmbientLight(0x404040);