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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(city): fix lighting controls, add sunset sky, replace fog with depth shader
Adam Eivy7b70ce516971
diff --git a/.changelog/v0.12.x.md b/.changelog/v0.12.x.mdindex 9444f2b85d..672253ed7f 100644--- a/.changelog/v0.12.x.md+++ b/.changelog/v0.12.x.md@@ -235,6 +235,24 @@ This release adds branch management and automated release workflow capabilities- `client/src/components/digital-twin/constants.js` — Added Genome tab with Dna icon- `client/src/services/api.js` — Added 8 genome API functions+### CyberCity — Lighting Controls, Sky Sun & Depth Fog+- **Fixed ambient brightness slider**: Slider now visibly changes scene brightness in real-time — all lights (ambient, point, animated, searchlight, sun directional) use refs + `useFrame` to read brightness every frame, ensuring immediate response to slider changes+- **Replaced FogExp2 with depth fog post-processing**: Three.js `FogExp2` made distant buildings transparent instead of foggy. Replaced with a custom GLSL depth fog shader that reads the depth buffer and blends distant pixels toward a dark blue fog color (`#06101a`), producing correct volumetric-style fog. Fog density slider controls near/far fog range; setting to 0 disables fog entirely+- **Cyberpunk sunset sky dome**: New `CitySky.jsx` component with a large inverted sphere using a custom gradient shader — deep indigo zenith, purple mid-sky, warm magenta/orange horizon — with animated noise ripple for living atmosphere+- **Glowing sun on horizon**: Emissive amber sphere with additive-blended glow halo ring, sitting low on the horizon for a perpetual cyberpunk sunset look+- **Sun directional light**: Real directional light emanating from the sun's position illuminates building faces with warm tone, intensity scaled by ambient brightness slider+- **Fog slider label**: Renamed "FOG DENSITY" to "FOG" for clarity++**New files**:+- `client/src/components/city/CitySky.jsx` — Sky dome gradient shader + sun mesh + directional light++**Modified files**:+- `client/src/components/city/CityLights.jsx` — Rewritten with refs + useFrame for reactive brightness+- `client/src/components/city/CityEffects.jsx` — Added DepthFogShader pass with depth texture render target+- `client/src/components/city/CityScene.jsx` — Removed fogExp2, added CitySky+- `client/src/components/city/cityConstants.js` — Added sky/sun color constants+- `client/src/components/city/CitySettingsPanel.jsx` — Renamed fog slider label+## Fixes### ClinVar Header Parsing — Zero Variants Parseddiff --git a/.gitignore b/.gitignoreindex 37427aa5cc..b389bbc1de 100644--- a/.gitignore+++ b/.gitignore@@ -18,6 +18,9 @@ logs/*.lognpm-debug.log*+# Screenshots+*.png+# OS files.DS_StoreThumbs.dbdiff --git a/client/src/components/city/CityEffects.jsx b/client/src/components/city/CityEffects.jsxindex 2eae749072..aa90226d4a 100644--- a/client/src/components/city/CityEffects.jsx+++ b/client/src/components/city/CityEffects.jsx@@ -106,9 +106,58 @@ const ColorGradingShader = {`,};+// Depth-based fog shader -- blends distant pixels toward fog color+const DepthFogShader = {+ uniforms: {+ tDiffuse: { value: null },+ tDepth: { value: null },+ uFogColor: { value: new THREE.Color(0x06101a) },+ uFogNear: { value: 20.0 },+ uFogFar: { value: 120.0 },+ uCameraNear: { value: 0.1 },+ uCameraFar: { value: 2000.0 },+ },+ vertexShader: `+ varying vec2 vUv;+ void main() {+ vUv = uv;+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);+ }+ `,+ fragmentShader: `+ uniform sampler2D tDiffuse;+ uniform sampler2D tDepth;+ uniform vec3 uFogColor;+ uniform float uFogNear;+ uniform float uFogFar;+ uniform float uCameraNear;+ uniform float uCameraFar;+ varying vec2 vUv;++ float toLinearDepth(float ndcDepth, float near, float far) {+ float viewZ = (near * far) / ((far - near) * ndcDepth - far);+ return -viewZ;+ }++ void main() {+ vec4 color = texture2D(tDiffuse, vUv);+ float rawDepth = texture2D(tDepth, vUv).x;++ float linearDepth = toLinearDepth(rawDepth, uCameraNear, uCameraFar);++ // Fog factor: 0 = no fog, 1 = full fog+ float fogFactor = smoothstep(uFogNear, uFogFar, linearDepth);++ color.rgb = mix(color.rgb, uFogColor, fogFactor);+ gl_FragColor = color;+ }+ `,+};+export default function CityEffects({ settings }) {const composerRef = useRef();const grainPassRef = useRef();+ const fogPassRef = useRef();const { gl, scene, camera, size } = useThree();const bloomEnabled = settings?.bloomEnabled ?? true;@@ -116,9 +165,23 @@ export default function CityEffects({ settings }) {const chromaticAberration = settings?.chromaticAberration ?? true;const filmGrain = settings?.filmGrain ?? true;const colorGrading = settings?.colorGrading ?? true;+ const fogDensity = settings?.fogDensity ?? 0.008;++ // Enable depth texture on the renderer's render target+ useEffect(() => {+ gl.getContext();+ }, [gl]);useEffect(() => {- const composer = new EffectComposer(gl);+ // Create render target with depth texture for fog shader+ const renderTarget = new THREE.WebGLRenderTarget(size.width, size.height, {+ depthTexture: new THREE.DepthTexture(),+ depthBuffer: true,+ });+ renderTarget.depthTexture.format = THREE.DepthFormat;+ renderTarget.depthTexture.type = THREE.UnsignedShortType;++ const composer = new EffectComposer(gl, renderTarget);composer.setSize(size.width, size.height);composer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5));@@ -135,6 +198,23 @@ export default function CityEffects({ settings }) {composer.addPass(bloomPass);}+ // Depth fog pass (after bloom, before color grading)+ if (fogDensity > 0) {+ const dfPass = new ShaderPass(DepthFogShader);+ dfPass.uniforms.tDepth.value = renderTarget.depthTexture;+ dfPass.uniforms.uCameraNear.value = camera.near;+ dfPass.uniforms.uCameraFar.value = camera.far;+ // Map fogDensity (0-0.03) to fog range: higher density = closer fog+ const fogNear = Math.max(5, 60 - fogDensity * 2000);+ const fogFar = Math.max(30, 200 - fogDensity * 4000);+ dfPass.uniforms.uFogNear.value = fogNear;+ dfPass.uniforms.uFogFar.value = fogFar;+ fogPassRef.current = dfPass;+ composer.addPass(dfPass);+ } else {+ fogPassRef.current = null;+ }+if (colorGrading) {const cgPass = new ShaderPass(ColorGradingShader);composer.addPass(cgPass);@@ -158,8 +238,10 @@ export default function CityEffects({ settings }) {return () => {composer.dispose();+ renderTarget.dispose();+ renderTarget.depthTexture.dispose();};- }, [gl, scene, camera, size.width, size.height, bloomEnabled, bloomStrength, chromaticAberration, filmGrain, colorGrading]);+ }, [gl, scene, camera, size.width, size.height, bloomEnabled, bloomStrength, chromaticAberration, filmGrain, colorGrading, fogDensity]);useFrame(({ clock }) => {if (grainPassRef.current) {diff --git a/client/src/components/city/CityLights.jsx b/client/src/components/city/CityLights.jsxindex 4dd620278a..fb51f75ec3 100644--- a/client/src/components/city/CityLights.jsx+++ b/client/src/components/city/CityLights.jsx@@ -1,30 +1,30 @@import { useRef } from 'react';import { useFrame } from '@react-three/fiber';-import { CITY_COLORS } from './cityConstants';-// Animated accent light that slowly shifts color-function AnimatedLight({ position, baseColor, intensity, distance, shiftRange = 0.1, speed = 0.5 }) {+// Animated accent light that slowly shifts color, with reactive brightness+function AnimatedLight({ position, baseColor, baseIntensity, distance, shiftRange = 0.1, speed = 0.5, brightnessRef }) {const ref = useRef();useFrame(({ clock }) => {if (!ref.current) return;+ const b = brightnessRef.current;const t = clock.getElapsedTime();- ref.current.intensity = intensity + Math.sin(t * speed) * intensity * shiftRange;+ ref.current.intensity = (baseIntensity + Math.sin(t * speed) * baseIntensity * shiftRange) * b;});return (<pointLightref={ref}position={position}- intensity={intensity}+ intensity={baseIntensity}color={baseColor}distance={distance}/>);}-// Sweeping searchlight effect-function Searchlight() {+// Sweeping searchlight effect with reactive brightness+function Searchlight({ brightnessRef }) {const ref = useRef();useFrame(({ clock }) => {@@ -34,7 +34,7 @@ function Searchlight() {const radius = 25;ref.current.position.x = Math.cos(angle) * radius;ref.current.position.z = Math.sin(angle) * radius;- // Point toward center+ ref.current.intensity = 0.6 * brightnessRef.current;ref.current.target.position.set(0, 0, 0);ref.current.target.updateMatrixWorld();});@@ -54,29 +54,58 @@ function Searchlight() {);}+// Static point light that updates intensity every frame from brightness ref+function ReactivePointLight({ position, baseIntensity, color, distance, brightnessRef }) {+ const ref = useRef();++ useFrame(() => {+ if (!ref.current) return;+ ref.current.intensity = baseIntensity * brightnessRef.current;+ });++ return (+ <pointLight+ ref={ref}+ position={position}+ intensity={baseIntensity}+ color={color}+ distance={distance}+ />+ );+}+export default function CityLights({ settings }) {- const b = settings?.ambientBrightness ?? 1.2;+ // Store brightness in a ref so useFrame callbacks always see current value+ const brightnessRef = useRef(settings?.ambientBrightness ?? 1.2);+ brightnessRef.current = settings?.ambientBrightness ?? 1.2;++ const ambientRef = useRef();+ useFrame(() => {+ if (!ambientRef.current) return;+ ambientRef.current.intensity = 0.18 * brightnessRef.current;+ });+return (<>- <ambientLight intensity={0.18 * b} color="#1a1a3a" />+ <ambientLight ref={ambientRef} intensity={0.18} color="#1a1a3a" />{/* Main overhead cyan */}- <pointLight position={[0, 30, 0]} intensity={1.2 * b} color="#06b6d4" distance={100} />+ <ReactivePointLight position={[0, 30, 0]} baseIntensity={1.2} color="#06b6d4" distance={100} brightnessRef={brightnessRef} />{/* Secondary overhead fill - broad white/blue */}- <pointLight position={[0, 20, 10]} intensity={0.5 * b} color="#4488cc" distance={90} />+ <ReactivePointLight position={[0, 20, 10]} baseIntensity={0.5} color="#4488cc" distance={90} brightnessRef={brightnessRef} />{/* Magenta accent from left - animated color shift */}- <AnimatedLight position={[-20, 12, -15]} baseColor="#ec4899" intensity={0.7 * b} distance={60} speed={0.3} shiftRange={0.15} />+ <AnimatedLight position={[-20, 12, -15]} baseColor="#ec4899" baseIntensity={0.7} distance={60} speed={0.3} shiftRange={0.15} brightnessRef={brightnessRef} />{/* Blue accent from right - animated shift */}- <AnimatedLight position={[20, 12, 15]} baseColor="#3b82f6" intensity={0.7 * b} distance={60} speed={0.4} shiftRange={0.12} />+ <AnimatedLight position={[20, 12, 15]} baseColor="#3b82f6" baseIntensity={0.7} distance={60} speed={0.4} shiftRange={0.12} brightnessRef={brightnessRef} />{/* Purple from behind - more presence */}- <pointLight position={[0, 15, -25]} intensity={0.5 * b} color="#8b5cf6" distance={60} />+ <ReactivePointLight position={[0, 15, -25]} baseIntensity={0.5} color="#8b5cf6" distance={60} brightnessRef={brightnessRef} />{/* Warm orange ground level accent */}- <pointLight position={[10, 3, 5]} intensity={0.35 * b} color="#f97316" distance={35} />+ <ReactivePointLight position={[10, 3, 5]} baseIntensity={0.35} color="#f97316" distance={35} brightnessRef={brightnessRef} />{/* Additional green accent - ground level from opposite side */}- <pointLight position={[-12, 3, 8]} intensity={0.2 * b} color="#22c55e" distance={25} />+ <ReactivePointLight position={[-12, 3, 8]} baseIntensity={0.2} color="#22c55e" distance={25} brightnessRef={brightnessRef} />{/* Red warning accent from below-right */}- <pointLight position={[15, 2, -10]} intensity={0.15 * b} color="#f43f5e" distance={22} />+ <ReactivePointLight position={[15, 2, -10]} baseIntensity={0.15} color="#f43f5e" distance={22} brightnessRef={brightnessRef} />{/* Sweeping searchlight */}- <Searchlight />+ <Searchlight brightnessRef={brightnessRef} /></>);}diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex 333fe1b741..941da65ce2 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -19,6 +19,7 @@ import CityDataRain from './CityDataRain';import CityNeonSigns from './CityNeonSigns';import CityEmbers from './CityEmbers';import CityEffects from './CityEffects';+import CitySky from './CitySky';export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, productivityData, settings, playSfx }) {const [positions, setPositions] = useState(null);@@ -38,9 +39,9 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,dpr={dpr}shadows={false}style={{ background: '#030308' }}- gl={{ antialias: true }}+ gl={{ antialias: true, logarithmicDepthBuffer: false }}>- <fogExp2 attach="fog" args={['#030308', settings?.fogDensity ?? 0.008]} />+ <CitySky settings={settings} /><CityLights settings={settings} /><CityStarfield /><CityShootingStars playSfx={playSfx} />diff --git a/client/src/components/city/CitySettingsPanel.jsx b/client/src/components/city/CitySettingsPanel.jsxindex 85ac3d24b4..98900fc576 100644--- a/client/src/components/city/CitySettingsPanel.jsx+++ b/client/src/components/city/CitySettingsPanel.jsx@@ -213,7 +213,7 @@ export default function CitySettingsPanel() {format={(v) => `${v.toFixed(1)}x`}/><SettingSlider- label="FOG DENSITY"+ label="FOG"value={settings.fogDensity}onChange={(v) => updateSetting('fogDensity', v)}min={0}diff --git a/client/src/components/city/CitySky.jsx b/client/src/components/city/CitySky.jsxnew file mode 100644index 0000000000..867aaeb8d3--- /dev/null+++ b/client/src/components/city/CitySky.jsx@@ -0,0 +1,175 @@+import { useRef, useMemo } from 'react';+import { useFrame } from '@react-three/fiber';+import * as THREE from 'three';+import { CITY_COLORS } from './cityConstants';++// Sun position: low on horizon, slightly off-center for drama+const SUN_POSITION = [-60, 8, -80];+const SUN_DIRECTION = new THREE.Vector3(...SUN_POSITION).normalize().negate();++// Sky dome gradient shader (inverted sphere)+const SkyDomeShader = {+ vertexShader: `+ varying vec3 vWorldPosition;+ void main() {+ vec4 worldPos = modelMatrix * vec4(position, 1.0);+ vWorldPosition = worldPos.xyz;+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);+ }+ `,+ fragmentShader: `+ uniform vec3 uZenith;+ uniform vec3 uMidSky;+ uniform vec3 uHorizonHigh;+ uniform vec3 uHorizonLow;+ uniform vec3 uSunDirection;+ uniform float uTime;+ varying vec3 vWorldPosition;++ // Simple noise for subtle atmosphere ripple+ float hash(vec2 p) {+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);+ }+ float noise(vec2 p) {+ vec2 i = floor(p);+ vec2 f = fract(p);+ f = f * f * (3.0 - 2.0 * f);+ float a = hash(i);+ float b = hash(i + vec2(1.0, 0.0));+ float c = hash(i + vec2(0.0, 1.0));+ float d = hash(i + vec2(1.0, 1.0));+ return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);+ }++ void main() {+ vec3 dir = normalize(vWorldPosition);+ // Height factor: 0 at horizon, 1 at zenith+ float h = max(dir.y, 0.0);++ // Base gradient bands+ vec3 color = uHorizonLow;+ color = mix(color, uHorizonHigh, smoothstep(0.0, 0.08, h));+ color = mix(color, uMidSky, smoothstep(0.05, 0.25, h));+ color = mix(color, uZenith, smoothstep(0.2, 0.6, h));++ // Sun glow on horizon+ float sunDot = max(dot(dir, uSunDirection), 0.0);+ float sunGlow = pow(sunDot, 8.0) * 0.4;+ color += vec3(1.0, 0.3, 0.15) * sunGlow;+ // Wider warm wash+ float warmWash = pow(sunDot, 3.0) * 0.15;+ color += vec3(0.8, 0.2, 0.3) * warmWash;++ // Subtle noise ripple for living atmosphere+ float n = noise(dir.xz * 3.0 + uTime * 0.02) * 0.03;+ color += n;++ // Below horizon: fade to black+ float belowFade = smoothstep(0.0, -0.05, dir.y);+ color = mix(color, vec3(0.01, 0.01, 0.03), belowFade);++ gl_FragColor = vec4(color, 1.0);+ }+ `,+};++// Glowing sun mesh on the horizon+function Sun({ brightnessRef }) {+ const sunRef = useRef();+ const haloRef = useRef();++ useFrame(({ clock }) => {+ if (!sunRef.current) return;+ const t = clock.getElapsedTime();+ // Gentle pulse+ const pulse = 1.0 + Math.sin(t * 0.5) * 0.1;+ sunRef.current.material.emissiveIntensity = 2.0 * pulse;+ if (haloRef.current) {+ haloRef.current.material.opacity = 0.15 + Math.sin(t * 0.3) * 0.05;+ }+ });++ return (+ <group position={SUN_POSITION}>+ {/* Sun core */}+ <mesh ref={sunRef}>+ <sphereGeometry args={[4, 24, 24]} />+ <meshStandardMaterial+ color={CITY_COLORS.sky.sunCore}+ emissive={CITY_COLORS.sky.sunCore}+ emissiveIntensity={2.0}+ toneMapped={false}+ />+ </mesh>+ {/* Glow halo ring */}+ <mesh ref={haloRef} rotation={[0, 0, 0]}>+ <ringGeometry args={[5, 14, 32]} />+ <meshBasicMaterial+ color={CITY_COLORS.sky.sunGlow}+ transparent+ opacity={0.15}+ side={THREE.DoubleSide}+ blending={THREE.AdditiveBlending}+ depthWrite={false}+ />+ </mesh>+ </group>+ );+}++// Directional light from the sun position+function SunLight({ brightnessRef }) {+ const ref = useRef();++ useFrame(() => {+ if (!ref.current) return;+ ref.current.intensity = 0.6 * brightnessRef.current;+ });++ return (+ <directionalLight+ ref={ref}+ position={SUN_POSITION}+ target-position={[0, 0, 0]}+ intensity={0.6}+ color={CITY_COLORS.sky.sunLight}+ />+ );+}++export default function CitySky({ settings }) {+ const brightnessRef = useRef(settings?.ambientBrightness ?? 1.2);+ brightnessRef.current = settings?.ambientBrightness ?? 1.2;++ const skyMaterial = useMemo(() => {+ return new THREE.ShaderMaterial({+ vertexShader: SkyDomeShader.vertexShader,+ fragmentShader: SkyDomeShader.fragmentShader,+ uniforms: {+ uZenith: { value: new THREE.Color(CITY_COLORS.sky.zenith) },+ uMidSky: { value: new THREE.Color(CITY_COLORS.sky.midSky) },+ uHorizonHigh: { value: new THREE.Color(CITY_COLORS.sky.horizonHigh) },+ uHorizonLow: { value: new THREE.Color(CITY_COLORS.sky.horizonLow) },+ uSunDirection: { value: SUN_DIRECTION },+ uTime: { value: 0 },+ },+ side: THREE.BackSide,+ depthWrite: false,+ });+ }, []);++ useFrame(({ clock }) => {+ skyMaterial.uniforms.uTime.value = clock.getElapsedTime();+ });++ return (+ <group>+ {/* Sky dome - large inverted sphere */}+ <mesh material={skyMaterial}>+ <sphereGeometry args={[500, 32, 32]} />+ </mesh>+ <Sun brightnessRef={brightnessRef} />+ <SunLight brightnessRef={brightnessRef} />+ </group>+ );+}diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.jsindex 3797804db4..84fc55e028 100644--- a/client/src/components/city/cityConstants.js+++ b/client/src/components/city/cityConstants.js@@ -21,6 +21,16 @@ export const CITY_COLORS = {// Celestial colorsplanet: '#3b82f6',orbit: '#1e3a5f',+ // Sky dome + sun colors+ sky: {+ zenith: '#050520',+ midSky: '#1a0a2e',+ horizonHigh: '#ff4060',+ horizonLow: '#ff8040',+ sunCore: '#ffaa44',+ sunGlow: '#ff6080',+ sunLight: '#ffccaa',+ },};export const BOROUGH_PARAMS = {