Spaces:
Running
Running
Dim the 3D lighting (part 2)
Browse files29 unmodified lines303132333435361 unmodified line383940414243444546474818 unmodified lines676869707172733 unmodified lines777879808182838485868729 unmodified linesfunction studioEnvironment(pmrem) {const env = new THREE.Scene();env.add(new THREE.Mesh(new THREE.BoxGeometry(10, 10, 10),new THREE.MeshBasicMaterial({ color: 0x9a9da2, side: THREE.BackSide })));const panel = (w, h, pos, power) => {const m = new THREE.Mesh(new THREE.PlaneGeometry(w, h),new THREE.MeshBasicMaterial({ color: new THREE.Color(1, 1, 1).multiplyScalar(power), side: THREE.DoubleSide }));1 unmodified linem.lookAt(0, 0, 0);env.add(m);};panel(7, 7, [0, 4.8, 0], 2.6); // overhead softboxpanel(5, 5, [-4.8, 1.5, 1], 2.2); // left (key side)panel(5, 5, [4.8, 1.5, -1], 1.6); // rightpanel(6, 4, [0, 1.5, 4.8], 1.4); // frontpanel(6, 4, [0, 1.5, -4.8], 1.4); // backconst ground = new THREE.Mesh(new THREE.PlaneGeometry(10, 10), new THREE.MeshBasicMaterial({ color: 0x55585d }));ground.rotation.x = -Math.PI / 2;ground.position.y = -4.9;18 unmodified linesrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));renderer.outputColorSpace = THREE.SRGBColorSpace;renderer.toneMapping = THREE.ACESFilmicToneMapping;renderer.toneMappingExposure = 1.0;renderer.shadowMap.enabled = true;renderer.shadowMap.type = THREE.PCFSoftShadowMap;stage.prepend(renderer.domElement);3 unmodified linesscene.fog = new THREE.Fog(STUDIO.horizon, 10, 50);const pmrem = new THREE.PMREMGenerator(renderer);scene.environment = studioEnvironment(pmrem);scene.add(new THREE.HemisphereLight(0xffffff, 0x6a6d72, 0.8));const fill = new THREE.DirectionalLight(0xffffff, 0.7); // opposite the key, no shadowconst rim = new THREE.DirectionalLight(0xffffff, 0.6); // from behind, lights the backscene.add(fill, fill.target, rim, rim.target);const key = new THREE.DirectionalLight(0xffffff, 1.5);key.castShadow = true;key.shadow.mapSize.set(2048, 2048);key.shadow.radius = 5;29 unmodified lines303132333435361 unmodified line383940414243444546474818 unmodified lines676869707172733 unmodified lines777879808182838485868729 unmodified linesfunction studioEnvironment(pmrem) {const env = new THREE.Scene();env.add(new THREE.Mesh(new THREE.BoxGeometry(10, 10, 10),new THREE.MeshBasicMaterial({ color: 0x75787d, side: THREE.BackSide })));const panel = (w, h, pos, power) => {const m = new THREE.Mesh(new THREE.PlaneGeometry(w, h),new THREE.MeshBasicMaterial({ color: new THREE.Color(1, 1, 1).multiplyScalar(power), side: THREE.DoubleSide }));1 unmodified linem.lookAt(0, 0, 0);env.add(m);};panel(7, 7, [0, 4.8, 0], 1.8); // overhead softboxpanel(5, 5, [-4.8, 1.5, 1], 1.5); // left (key side)panel(5, 5, [4.8, 1.5, -1], 1.1); // rightpanel(6, 4, [0, 1.5, 4.8], 0.95); // frontpanel(6, 4, [0, 1.5, -4.8], 0.95); // backconst ground = new THREE.Mesh(new THREE.PlaneGeometry(10, 10), new THREE.MeshBasicMaterial({ color: 0x55585d }));ground.rotation.x = -Math.PI / 2;ground.position.y = -4.9;18 unmodified linesrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));renderer.outputColorSpace = THREE.SRGBColorSpace;renderer.toneMapping = THREE.ACESFilmicToneMapping;renderer.toneMappingExposure = 0.85;renderer.shadowMap.enabled = true;renderer.shadowMap.type = THREE.PCFSoftShadowMap;stage.prepend(renderer.domElement);3 unmodified linesscene.fog = new THREE.Fog(STUDIO.horizon, 10, 50);const pmrem = new THREE.PMREMGenerator(renderer);scene.environment = studioEnvironment(pmrem);scene.add(new THREE.HemisphereLight(0xffffff, 0x6a6d72, 0.5));const fill = new THREE.DirectionalLight(0xffffff, 0.45); // opposite the key, no shadowconst rim = new THREE.DirectionalLight(0xffffff, 0.4); // from behind, lights the backscene.add(fill, fill.target, rim, rim.target);const key = new THREE.DirectionalLight(0xffffff, 1.25);key.castShadow = true;key.shadow.mapSize.set(2048, 2048);key.shadow.radius = 5;
viewer.js+11-11