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): address PR review feedback for sky theme and exposure features

Ilya Eivye8e85ca97c80
diff --git a/client/src/components/city/CityClouds.jsx b/client/src/components/city/CityClouds.jsx
index bf9a504312..c7de58cc20 100644
--- a/client/src/components/city/CityClouds.jsx
+++ b/client/src/components/city/CityClouds.jsx
@@ -1,4 +1,4 @@
-import { useRef, useMemo } from 'react';
+import { useRef, useMemo, useEffect } from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';
@@ -75,6 +75,8 @@ function Cloud({ position, scale, speed, seed }) {
blending: THREE.NormalBlending,
}), [seed]);
+ useEffect(() => () => material.dispose(), [material]);
+
useFrame(({ clock, camera }) => {
if (!meshRef.current) return;
const t = clock.getElapsedTime();
diff --git a/client/src/components/city/CityEffects.jsx b/client/src/components/city/CityEffects.jsx
index d0ef09e60d..34e51a047a 100644
--- a/client/src/components/city/CityEffects.jsx
+++ b/client/src/components/city/CityEffects.jsx
@@ -30,7 +30,8 @@ const ExposureShader = {
void main() {
vec4 color = texture2D(tDiffuse, vUv);
// Reverse power curve: lifts shadows/midtones, preserves highlights
- color.rgb = 1.0 - pow(max(1.0 - color.rgb, 0.0), vec3(1.0 / uExposure));
+ float safeExposure = max(uExposure, 0.001);
+ color.rgb = 1.0 - pow(max(1.0 - color.rgb, 0.0), vec3(1.0 / safeExposure));
gl_FragColor = color;
}
`,
@@ -137,6 +138,7 @@ const ColorGradingShader = {
export default function CityEffects({ settings }) {
const composerRef = useRef();
const grainPassRef = useRef();
+ const exposurePassRef = useRef();
const { gl, scene, camera, size } = useThree();
const bloomEnabled = settings?.bloomEnabled ?? true;
@@ -164,13 +166,13 @@ export default function CityEffects({ settings }) {
composer.addPass(bloomPass);
}
- // Exposure pass — runs after bloom so it lifts shadows/midtones
- // without feeding extra brightness into the bloom calculation
- if (sceneExposure !== 1.0) {
- const exposurePass = new ShaderPass(ExposureShader);
- exposurePass.uniforms.uExposure.value = sceneExposure;
- composer.addPass(exposurePass);
- }
+ // Exposure pass — always added, enabled/disabled via ref to avoid
+ // recreating the composer when the slider is dragged
+ const exposurePass = new ShaderPass(ExposureShader);
+ exposurePass.enabled = sceneExposure !== 1.0;
+ exposurePass.uniforms.uExposure.value = sceneExposure;
+ exposurePassRef.current = exposurePass;
+ composer.addPass(exposurePass);
if (colorGrading) {
const cgPass = new ShaderPass(ColorGradingShader);
@@ -196,9 +198,13 @@ export default function CityEffects({ settings }) {
return () => {
composer.dispose();
};
- }, [gl, scene, camera, size.width, size.height, bloomEnabled, bloomStrength, sceneExposure, chromaticAberration, filmGrain, colorGrading]);
+ }, [gl, scene, camera, size.width, size.height, bloomEnabled, bloomStrength, chromaticAberration, filmGrain, colorGrading]);
useFrame(({ clock }) => {
+ if (exposurePassRef.current) {
+ exposurePassRef.current.enabled = sceneExposure !== 1.0;
+ exposurePassRef.current.uniforms.uExposure.value = sceneExposure;
+ }
if (grainPassRef.current) {
grainPassRef.current.uniforms.uTime.value = clock.getElapsedTime();
}
diff --git a/client/src/components/city/CitySettingsPanel.jsx b/client/src/components/city/CitySettingsPanel.jsx
index 85895e198f..b501aea2ac 100644
--- a/client/src/components/city/CitySettingsPanel.jsx
+++ b/client/src/components/city/CitySettingsPanel.jsx
@@ -262,7 +262,7 @@ export default function CitySettingsPanel() {
max={2.5}
step={0.1}
format={(v) => `${v.toFixed(1)}x`}
- description="Post-bloom brightness lift — brightens assets without adding bloom"
+ description="Post-bloom exposure adjustment — darkens or brightens assets without adding bloom"
/>
<SettingSlider
label="AMBIENT BRIGHTNESS"