Fix: improved light effect
This commit is contained in:
parent
1d1c8da558
commit
d9dd5a56d1
@ -19,7 +19,7 @@ export class LightBall extends SceneFeature {
|
|||||||
// --- Ball Properties ---
|
// --- Ball Properties ---
|
||||||
const ballRadius = 0.4;
|
const ballRadius = 0.4;
|
||||||
const lightIntensity = 5.0;
|
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 => {
|
lightColors.forEach(color => {
|
||||||
// --- Create the Ball ---
|
// --- Create the Ball ---
|
||||||
@ -31,11 +31,10 @@ export class LightBall extends SceneFeature {
|
|||||||
|
|
||||||
// --- Create the Light ---
|
// --- Create the Light ---
|
||||||
const light = new THREE.PointLight(color, lightIntensity, length / 1.5);
|
const light = new THREE.PointLight(color, lightIntensity, length / 1.5);
|
||||||
light.castShadow = true;
|
light.shadow.mapSize.width = 1024;
|
||||||
light.shadow.mapSize.width = 512;
|
light.shadow.mapSize.height = 1024;
|
||||||
light.shadow.mapSize.height = 512;
|
|
||||||
light.shadow.camera.near = 0.1;
|
light.shadow.camera.near = 0.1;
|
||||||
light.shadow.camera.far = length / 2;
|
light.shadow.camera.far = 200;
|
||||||
|
|
||||||
// --- Initial Position ---
|
// --- Initial Position ---
|
||||||
ball.position.set(
|
ball.position.set(
|
||||||
|
|||||||
@ -32,8 +32,9 @@ export class StainedGlass extends SceneFeature {
|
|||||||
side: THREE.DoubleSide,
|
side: THREE.DoubleSide,
|
||||||
metalness: 0.1, // Glass is not very metallic
|
metalness: 0.1, // Glass is not very metallic
|
||||||
roughness: 0.3, // Glass is smooth
|
roughness: 0.3, // Glass is smooth
|
||||||
clearcoat: 1.0,
|
emissive: 0x222222, // Set to white to use vertex colors for glow
|
||||||
emissive: 0x000000, // We will control emissiveness via update
|
emissiveIntensity: 0.1, // Start with a base intensity
|
||||||
|
//blending: THREE.AdditiveBlending, // Additive blending for a bright, glowing effect
|
||||||
});
|
});
|
||||||
|
|
||||||
const colorPalette = [
|
const colorPalette = [
|
||||||
@ -235,8 +236,8 @@ export class StainedGlass extends SceneFeature {
|
|||||||
update(deltaTime) {
|
update(deltaTime) {
|
||||||
// Add a subtle pulsing glow to the windows
|
// Add a subtle pulsing glow to the windows
|
||||||
const pulseSpeed = 0.5;
|
const pulseSpeed = 0.5;
|
||||||
const minIntensity = 0.5;
|
const minIntensity = 0.1; // Increased intensity for a stronger glow
|
||||||
const maxIntensity = 0.9;
|
const maxIntensity = 0.2;
|
||||||
const intensity = minIntensity + (maxIntensity - minIntensity) * (0.5 * (1 + Math.sin(state.clock.getElapsedTime() * pulseSpeed)));
|
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
|
// To make the glow match the vertex colors, we set the emissive color to white
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user