Fix: improved light effect

This commit is contained in:
Dejvino 2025-11-21 23:07:31 +01:00
parent 1d1c8da558
commit d9dd5a56d1
2 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@ export class LightBall extends SceneFeature {
// --- Ball Properties ---
const ballRadius = 0.4;
const lightIntensity = 5.0;
const lightColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0x558800]; // Red, Green, Blue, Yellow
const lightColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0x00ffff]; // Red, Green, Blue, Yellow
lightColors.forEach(color => {
// --- Create the Ball ---
@ -31,11 +31,10 @@ export class LightBall extends SceneFeature {
// --- Create the Light ---
const light = new THREE.PointLight(color, lightIntensity, length / 1.5);
light.castShadow = true;
light.shadow.mapSize.width = 512;
light.shadow.mapSize.height = 512;
light.shadow.mapSize.width = 1024;
light.shadow.mapSize.height = 1024;
light.shadow.camera.near = 0.1;
light.shadow.camera.far = length / 2;
light.shadow.camera.far = 200;
// --- Initial Position ---
ball.position.set(

View File

@ -32,8 +32,9 @@ export class StainedGlass extends SceneFeature {
side: THREE.DoubleSide,
metalness: 0.1, // Glass is not very metallic
roughness: 0.3, // Glass is smooth
clearcoat: 1.0,
emissive: 0x000000, // We will control emissiveness via update
emissive: 0x222222, // Set to white to use vertex colors for glow
emissiveIntensity: 0.1, // Start with a base intensity
//blending: THREE.AdditiveBlending, // Additive blending for a bright, glowing effect
});
const colorPalette = [
@ -235,8 +236,8 @@ export class StainedGlass extends SceneFeature {
update(deltaTime) {
// Add a subtle pulsing glow to the windows
const pulseSpeed = 0.5;
const minIntensity = 0.5;
const maxIntensity = 0.9;
const minIntensity = 0.1; // Increased intensity for a stronger glow
const maxIntensity = 0.2;
const intensity = minIntensity + (maxIntensity - minIntensity) * (0.5 * (1 + Math.sin(state.clock.getElapsedTime() * pulseSpeed)));
// To make the glow match the vertex colors, we set the emissive color to white