Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(city): add hemisphere sky light for proper daytime illumination

Adam Eivy5185c16b5af3
diff --git a/client/src/components/city/CityLights.jsx b/client/src/components/city/CityLights.jsx
index b508fbe397..3748e0d6f9 100644
--- a/client/src/components/city/CityLights.jsx
+++ b/client/src/components/city/CityLights.jsx
@@ -77,25 +77,50 @@ function ReactivePointLight({ position, baseIntensity, color, distance, brightne
}
export default function CityLights({ settings }) {
- // Combine ambient brightness slider with time-of-day daylight factor
+ // Neon point lights only scale with ambient brightness slider (not daylight factor)
+ const brightnessRef = useRef(settings?.ambientBrightness ?? 1.2);
+ brightnessRef.current = settings?.ambientBrightness ?? 1.2;
+
const timeOfDay = settings?.timeOfDay ?? 'sunset';
const preset = CITY_COLORS.timeOfDay[timeOfDay] ?? CITY_COLORS.timeOfDay.sunset;
- const brightnessRef = useRef((settings?.ambientBrightness ?? 1.2) * preset.daylightFactor);
- brightnessRef.current = (settings?.ambientBrightness ?? 1.2) * preset.daylightFactor;
+ // Hemisphere light refs — provides natural sky fill (like Unreal Engine's Sky Light)
+ const hemiRef = useRef();
+ const hemiSkyTarget = useRef(new THREE.Color(preset.hemiSkyColor));
+ const hemiGroundTarget = useRef(new THREE.Color(preset.hemiGroundColor));
+ hemiSkyTarget.current.set(preset.hemiSkyColor);
+ hemiGroundTarget.current.set(preset.hemiGroundColor);
+ const hemiIntensityTarget = useRef(preset.hemiIntensity);
+ hemiIntensityTarget.current = preset.hemiIntensity * brightnessRef.current;
+
+ // Ambient light refs
+ const ambientRef = useRef();
const ambientColorTarget = useRef(new THREE.Color(preset.ambientColor));
ambientColorTarget.current.set(preset.ambientColor);
+ const ambientIntensityTarget = useRef(preset.ambientIntensity);
+ ambientIntensityTarget.current = preset.ambientIntensity * brightnessRef.current;
- const ambientRef = useRef();
useFrame((_, delta) => {
- if (!ambientRef.current) return;
- ambientRef.current.intensity = 0.18 * brightnessRef.current;
- // Smoothly lerp ambient color toward target
- ambientRef.current.color.lerp(ambientColorTarget.current, Math.min(1, delta * 3));
+ const lf = Math.min(1, delta * 3);
+
+ // Hemisphere light — main daytime fill
+ if (hemiRef.current) {
+ hemiRef.current.color.lerp(hemiSkyTarget.current, lf);
+ hemiRef.current.groundColor.lerp(hemiGroundTarget.current, lf);
+ hemiRef.current.intensity += (hemiIntensityTarget.current - hemiRef.current.intensity) * lf;
+ }
+
+ // Ambient light
+ if (ambientRef.current) {
+ ambientRef.current.color.lerp(ambientColorTarget.current, lf);
+ ambientRef.current.intensity += (ambientIntensityTarget.current - ambientRef.current.intensity) * lf;
+ }
});
return (
<>
+ {/* Hemisphere sky light — like Unreal Engine's Sky Light, illuminates all geometry from sky/ground */}
+ <hemisphereLight ref={hemiRef} color="#1a1a3a" groundColor="#0a0a20" intensity={0.3} />
<ambientLight ref={ambientRef} intensity={0.18} color="#1a1a3a" />
{/* Main overhead cyan */}
<ReactivePointLight position={[0, 30, 0]} baseIntensity={1.2} color="#06b6d4" distance={100} brightnessRef={brightnessRef} />
diff --git a/client/src/components/city/CitySky.jsx b/client/src/components/city/CitySky.jsx
index 2026052b29..1f026672aa 100644
--- a/client/src/components/city/CitySky.jsx
+++ b/client/src/components/city/CitySky.jsx
@@ -120,7 +120,6 @@ const getPresetColors = (name) => {
sunIntensity: p.sunIntensity,
sunScale: p.sunScale,
isMoon: p.isMoon,
- daylightFactor: p.daylightFactor,
};
}
return presetColors[name];
diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.js
index 9ceace756e..d20f2f4d9b 100644
--- a/client/src/components/city/cityConstants.js
+++ b/client/src/components/city/cityConstants.js
@@ -32,11 +32,15 @@ export const CITY_COLORS = {
sunCore: '#ff8844',
sunGlow: '#ff6060',
sunLight: '#ffccaa',
- sunIntensity: 0.5,
+ sunIntensity: 2.0,
sunScale: 1.0,
isMoon: false,
- daylightFactor: 0.6,
+ // Hemisphere sky light (Unreal Engine "sky light" equivalent)
+ hemiSkyColor: '#ff9966',
+ hemiGroundColor: '#1a1020',
+ hemiIntensity: 0.4,
ambientColor: '#2a1a3a',
+ ambientIntensity: 0.18,
},
noon: {
hour: 12,
@@ -47,11 +51,14 @@ export const CITY_COLORS = {
sunCore: '#ffffee',
sunGlow: '#ffffcc',
sunLight: '#ffffff',
- sunIntensity: 1.5,
+ sunIntensity: 5.0,
sunScale: 0.7,
isMoon: false,
- daylightFactor: 2.5,
+ hemiSkyColor: '#aaccee',
+ hemiGroundColor: '#334455',
+ hemiIntensity: 2.0,
ambientColor: '#6688aa',
+ ambientIntensity: 0.5,
},
sunset: {
hour: 18,
@@ -62,11 +69,14 @@ export const CITY_COLORS = {
sunCore: '#ffaa44',
sunGlow: '#ff6080',
sunLight: '#ffccaa',
- sunIntensity: 0.6,
+ sunIntensity: 1.5,
sunScale: 1.0,
isMoon: false,
- daylightFactor: 0.6,
+ hemiSkyColor: '#ff6644',
+ hemiGroundColor: '#0a0a20',
+ hemiIntensity: 0.3,
ambientColor: '#1a1a3a',
+ ambientIntensity: 0.18,
},
midnight: {
hour: 0,
@@ -80,8 +90,11 @@ export const CITY_COLORS = {
sunIntensity: 0.12,
sunScale: 0.6,
isMoon: true,
- daylightFactor: 0.3,
+ hemiSkyColor: '#111122',
+ hemiGroundColor: '#050508',
+ hemiIntensity: 0.05,
ambientColor: '#0a0a1a',
+ ambientIntensity: 0.1,
},
},
};