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
move mesh preview controls below the canvas and make the lighting sliders effective
[._.]/ Adam Eivyb33a7c79520d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex a64c8eb646..3b1b306669 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,7 +2,7 @@## 3D-- **Mesh previews now support lighting adjustments and an HDRI backdrop** — tune ambient, key, and fill lights while inspecting a 3D model, and optionally show the studio environment as its background.+- **Mesh preview display controls moved out of the render, and the lighting sliders now actually change the lighting** — the settings panel was an always-mounted overlay pinned inside the canvas, covering the upper-right quadrant of every model; it now lives behind a small toggle in the corner and expands as a strip *below* the render, so it can never occlude the mesh. Two of the controls it exposed were also effectively inert. The procedural studio environment lit the model at full strength and drowned out Ambient/Key/Fill — a new **Environment** slider dials the image-based lighting down (to 0 for lights-only), and the three light defaults were rebalanced against it. **Show HDRI background** revealed a cube map whose unlit areas were pure black, so the studio read as hard-edged white panels floating in a void (and only ever lit the model from three directions); an inward-facing backdrop sphere fills the gaps, and the map is rendered at 256 instead of 128. The scene-level background color was dropped in favor of the surface's CSS color it duplicated — a scene background raced the environment's own `scene.background` save/restore every time the HDRI toggle or the color picker changed.- **Generated meshes are easier to inspect and get a denser texture atlas on high-memory Macs** — the GLB preview now has an always-visible background color picker, and an offline procedural light environment makes TRELLIS's metallic PBR surfaces readable instead of turning details such as dark glass into black patches. Newly generated models use a 4K texture bake when at least 48 GB of unified memory is available (four times the 2K texel budget); supported 24 GB systems keep the proven 2K path.- **TRELLIS.2 models no longer render with transparent holes, and high-memory Macs use the sharper texture pipeline** — existing generated meshes now display as solid in the 3D viewer, while newly generated GLBs are normalized to the opaque material mode TRELLIS intended. Macs with at least 48 GB of unified memory now use 1024-cascade generation for better surface-detail placement; supported 24 GB systems stay on the proven lower-memory lane. Re-rendering the same record also refreshes the viewer immediately instead of showing its URL-cached previous mesh.- **[issue-3041] Installing TRELLIS.2 now fetches the Apple toolchain it needs, instead of telling you to run a command** — #2952 made the "correct shape, confetti surface" problem *visible*, but the fix was still a terminal command you had to copy out of a warning and run yourself — leaving every new install one manual step away from bad-looking renders. Installing (or repairing) TRELLIS.2 now downloads Apple's Xcode Metal Toolchain itself when it's missing, before the setup that needs it, so a fresh install produces properly textured meshes with nothing extra to do. No password is required and the download is skipped entirely when you already have it. **Repair install** on an existing degraded copy now genuinely fixes it rather than re-running the same broken setup. Two honest edge cases: if the download fails the install continues anyway (your geometry is unaffected, and the finished install tells you textures will be reduced), and on a Mac with only the Command Line Tools — where nothing PortOS runs can fetch the toolchain — you get a note naming Xcode as the prerequisite and no Repair button that would only fail.diff --git a/client/src/components/media/GlbViewer.jsx b/client/src/components/media/GlbViewer.jsxindex 1cbc3f99a0..e2893b8259 100644--- a/client/src/components/media/GlbViewer.jsx+++ b/client/src/components/media/GlbViewer.jsx@@ -7,9 +7,15 @@ import {OrbitControls,useGLTF,} from '@react-three/drei';-import { Download, Rotate3d } from 'lucide-react';+import { Download, Rotate3d, SlidersHorizontal } from 'lucide-react';+import { BackSide } from 'three';const DEFAULT_BACKGROUND = '#050505';+// The procedural environment renders into a cube map whose unlit areas would+// otherwise be pure black — so "Show HDRI background" produced hard-edged white+// panels floating in a void, and the IBL only ever lit from three directions. An+// inward-facing sphere fills the gaps so the environment reads as a studio.+const ENVIRONMENT_BACKDROP = '#2b2b2b';// Reusable viewer for a generated `.glb` mesh: drei `useGLTF` loads the model,// `Bounds fit` frames it regardless of the source's scale, `OrbitControls` lets@@ -75,8 +81,8 @@ function GlbModel({ src, forceOpaque }) {function LightingControl({ label, max, value, onChange }) {return (- <label className="mb-1 flex items-center gap-2 last:mb-0">- <span className="w-12">{label}</span>+ <label className="flex items-center gap-2">+ <span className="w-20">{label}</span><inputtype="range"min="0"@@ -87,7 +93,7 @@ function LightingControl({ label, max, value, onChange }) {aria-label={`${label} light`}className="min-w-0 flex-1 accent-port-accent"/>- <output className="w-5 text-right tabular-nums text-gray-300">{value.toFixed(1)}</output>+ <output className="w-7 text-right tabular-nums text-gray-300">{value.toFixed(1)}</output></label>);}@@ -105,11 +111,17 @@ export default function GlbViewer({initialBackground = DEFAULT_BACKGROUND,}) {const backgroundInputId = useId();+ const controlsPanelId = useId();const [background, setBackground] = useState(initialBackground);- const [ambientIntensity, setAmbientIntensity] = useState(0.9);- const [keyIntensity, setKeyIntensity] = useState(1.1);+ const [ambientIntensity, setAmbientIntensity] = useState(0.6);+ const [keyIntensity, setKeyIntensity] = useState(1.2);const [fillIntensity, setFillIntensity] = useState(0.4);+ // The image-based lighting is strong enough to flatten the three light+ // sliders when left at full strength — exposing it as its own control is what+ // makes Ambient/Key/Fill visibly matter (dial it to 0 for lights-only).+ const [environmentIntensity, setEnvironmentIntensity] = useState(0.6);const [showEnvironmentBackground, setShowEnvironmentBackground] = useState(false);+ const [controlsOpen, setControlsOpen] = useState(false);if (!src) return null;const href = downloadHref || src;// With an explicit download endpoint the server's Content-Disposition wins, so@@ -122,42 +134,42 @@ export default function GlbViewer({className="relative aspect-square w-full"style={{ backgroundColor: background }}>- <div className="absolute right-2 top-2 z-10 w-52 rounded-lg border border-white/20 bg-black/70 p-2 text-xs text-white shadow-lg backdrop-blur-sm">- <div className="flex items-center justify-between gap-2">- <label htmlFor={backgroundInputId}>Background</label>- <input- id={backgroundInputId}- type="color"- value={background}- onChange={(event) => setBackground(event.target.value)}- aria-label="Mesh preview background"- className="h-7 w-9 cursor-pointer rounded border border-white/30 bg-transparent p-0.5"- />- </div>- <div className="mt-2 border-t border-white/15 pt-2">- <p className="mb-1.5 text-[10px] font-medium uppercase tracking-wide text-gray-300">Lighting</p>- <LightingControl label="Ambient" max={2} value={ambientIntensity} onChange={setAmbientIntensity} />- <LightingControl label="Key" max={3} value={keyIntensity} onChange={setKeyIntensity} />- <LightingControl label="Fill" max={2} value={fillIntensity} onChange={setFillIntensity} />- <label className="mt-2 flex items-center gap-2 border-t border-white/15 pt-2 text-gray-200">- <input- type="checkbox"- checked={showEnvironmentBackground}- onChange={(event) => setShowEnvironmentBackground(event.target.checked)}- className="accent-port-accent"- />- Show HDRI background- </label>- </div>- </div>+ {/* Settings live in a collapsed strip BELOW the canvas, not an overlay —+ an always-on panel covered the upper-right quadrant of the model. */}+ <button+ type="button"+ onClick={() => setControlsOpen((open) => !open)}+ aria-expanded={controlsOpen}+ aria-controls={controlsPanelId}+ aria-label="Preview display settings"+ title="Preview display settings"+ className={`absolute right-2 top-2 z-10 inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-md border border-white/20 bg-black/60 text-white backdrop-blur-sm hover:bg-black/80 focus-visible:ring-2 focus-visible:ring-port-accent sm:min-h-0 sm:min-w-0 sm:p-1.5 ${controlsOpen ? 'ring-1 ring-port-accent' : ''}`}+ >+ <SlidersHorizontal className="h-4 w-4" />+ </button>+ {/* No `<color attach="background">`: r3f canvases are alpha-clear, so the+ surface's CSS color already IS the backdrop. A scene-level color only+ duplicates it while racing Environment's own scene.background+ save/restore whenever the HDRI toggle or the picker changes. */}<Canvas camera={{ position: [0, 0, 3], fov: 45 }} dpr={[1, 2]}>- <color attach="background" args={[background]} /><ambientLight intensity={ambientIntensity} /><directionalLight position={[4, 6, 5]} intensity={keyIntensity} /><directionalLight position={[-4, -2, -5]} intensity={fillIntensity} />{/* A procedural environment keeps metallic PBR textures readable without- downloading an HDR preset — PortOS installs can be fully offline. */}- <Environment background={showEnvironmentBackground} resolution={128}>+ downloading an HDR preset — PortOS installs can be fully offline.+ Keep these children inline: drei applies `environmentIntensity`+ from an effect that doesn't list it as a dependency, so the slider+ only reaches the scene because inline children change identity on+ every render. Memoizing them would silently freeze it. */}+ <Environment+ background={showEnvironmentBackground}+ resolution={256}+ environmentIntensity={environmentIntensity}+ >+ <mesh scale={100}>+ <sphereGeometry args={[1, 32, 32]} />+ <meshBasicMaterial color={ENVIRONMENT_BACKDROP} side={BackSide} />+ </mesh><Lightformerform="rect"intensity={3}@@ -188,6 +200,42 @@ export default function GlbViewer({<OrbitControls makeDefault enablePan enableZoom enableRotate /></Canvas></div>+ {controlsOpen && (+ <div+ id={controlsPanelId}+ className="grid gap-x-6 gap-y-2 border-t border-port-border bg-port-card px-3 py-2.5 text-xs text-gray-200 sm:grid-cols-2"+ >+ <LightingControl label="Ambient" max={2} value={ambientIntensity} onChange={setAmbientIntensity} />+ <LightingControl label="Key" max={3} value={keyIntensity} onChange={setKeyIntensity} />+ <LightingControl label="Fill" max={2} value={fillIntensity} onChange={setFillIntensity} />+ <LightingControl+ label="Environment"+ max={2}+ value={environmentIntensity}+ onChange={setEnvironmentIntensity}+ />+ <div className="flex items-center gap-2">+ <label htmlFor={backgroundInputId} className="w-20">Background</label>+ <input+ id={backgroundInputId}+ type="color"+ value={background}+ onChange={(event) => setBackground(event.target.value)}+ aria-label="Mesh preview background"+ className="h-7 w-10 cursor-pointer rounded border border-port-border bg-transparent p-0.5"+ />+ </div>+ <label className="flex items-center gap-2">+ <input+ type="checkbox"+ checked={showEnvironmentBackground}+ onChange={(event) => setShowEnvironmentBackground(event.target.checked)}+ className="accent-port-accent"+ />+ Show HDRI background+ </label>+ </div>+ )}<div className="flex items-center justify-between gap-2 border-t border-port-border px-3 py-2"><span className="inline-flex items-center gap-1.5 text-xs text-gray-500"><Rotate3d className="h-3.5 w-3.5" /> Drag to orbit · scroll to zoomdiff --git a/client/src/components/media/GlbViewer.test.jsx b/client/src/components/media/GlbViewer.test.jsxindex fbbddea6f1..1c74bc5dd3 100644--- a/client/src/components/media/GlbViewer.test.jsx+++ b/client/src/components/media/GlbViewer.test.jsx@@ -12,8 +12,14 @@ vi.mock('@react-three/fiber', () => ({ Canvas: ({ children }) => <div data-testivi.mock('@react-three/drei', () => ({Canvas: () => null,OrbitControls: () => null,- Environment: ({ background, children }) => (- <div data-testid="glb-environment" data-background={background ? 'visible' : 'hidden'}>{children}</div>+ Environment: ({ background, environmentIntensity, children }) => (+ <div+ data-testid="glb-environment"+ data-background={background ? 'visible' : 'hidden'}+ data-env-intensity={String(environmentIntensity)}+ >+ {children}+ </div>),Lightformer: () => null,Bounds: () => null,@@ -22,6 +28,8 @@ vi.mock('@react-three/drei', () => ({import GlbViewer, { cloneGlbSceneWithOpaqueMaterials } from './GlbViewer';+const openControls = () => fireEvent.click(screen.getByLabelText('Preview display settings'));+describe('GlbViewer', () => {it('renders nothing without a src', () => {const { container } = render(<GlbViewer src="" />);@@ -36,8 +44,25 @@ describe('GlbViewer', () => {expect(link).toHaveAttribute('download', 'robot-a1b2.glb');});+ // The controls used to be an always-mounted overlay pinned inside the canvas,+ // which covered the upper-right quadrant of every model.+ it('keeps the display controls collapsed and outside the render surface', () => {+ render(<GlbViewer src="/data/models3d/robot-a1b2.glb" />);+ expect(screen.queryByLabelText('Mesh preview background')).not.toBeInTheDocument();++ openControls();++ const picker = screen.getByLabelText('Mesh preview background');+ expect(screen.getByTestId('glb-preview-surface')).not.toContainElement(picker);+ expect(screen.getByLabelText('Preview display settings')).toHaveAttribute('aria-expanded', 'true');++ openControls();+ expect(screen.queryByLabelText('Mesh preview background')).not.toBeInTheDocument();+ });+it('lets the user change the mesh preview background', () => {render(<GlbViewer src="/data/models3d/robot-a1b2.glb" />);+ openControls();const picker = screen.getByLabelText('Mesh preview background');expect(picker).toHaveValue('#050505');@@ -50,12 +75,13 @@ describe('GlbViewer', () => {it('offers basic lighting controls and can show the HDRI environment as the background', () => {render(<GlbViewer src="/data/models3d/robot-a1b2.glb" />);+ openControls();const ambient = screen.getByLabelText('Ambient light');const key = screen.getByLabelText('Key light');const fill = screen.getByLabelText('Fill light');- expect(ambient).toHaveValue('0.9');- expect(key).toHaveValue('1.1');+ expect(ambient).toHaveValue('0.6');+ expect(key).toHaveValue('1.2');expect(fill).toHaveValue('0.4');expect(screen.getByTestId('glb-environment')).toHaveAttribute('data-background', 'hidden');@@ -71,6 +97,22 @@ describe('GlbViewer', () => {expect(screen.getByTestId('glb-environment')).toHaveAttribute('data-background', 'visible');});+ // The image-based lighting drowned out the three light sliders at full+ // strength — dialing the environment down is what makes them visible.+ it('drives the environment intensity from its own slider', () => {+ render(<GlbViewer src="/data/models3d/robot-a1b2.glb" />);+ openControls();++ const environment = screen.getByLabelText('Environment light');+ expect(environment).toHaveValue('0.6');+ expect(screen.getByTestId('glb-environment')).toHaveAttribute('data-env-intensity', '0.6');++ fireEvent.change(environment, { target: { value: '0' } });++ expect(environment).toHaveValue('0');+ expect(screen.getByTestId('glb-environment')).toHaveAttribute('data-env-intensity', '0');+ });+it('honors an explicit downloadName over the derived one', () => {render(<GlbViewer src="/data/models3d/x.glb?v=2" downloadName="my-mesh.glb" />);expect(screen.getByRole('link', { name: /Download \.glb/i })).toHaveAttribute('download', 'my-mesh.glb');