Recreating macOS’s Drift Screensaver with Rust and WASM
31–40 of 47 posts
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#32Why did screensavers ever do anything besides just blanking the screen?
b) Fun
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#33Why did screensavers ever do anything besides just blanking the screen?
I think the intent was not only to not do harm, but to undo the burn-in caused when the screen is on by cycling each pixel on and off. (Early CRT monitors used to have a “memory” of what was on there before, similar to the artifacts left behind after e-ink screens are cleared)
So either your screen was always on, or you printed moving pattern to avoid burning the phosphor.
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#34Why did screensavers ever do anything besides just blanking the screen?
If the monitor is going to be on anyway, why wouldn't people want to display something interesting on it?
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#35"it might stand to dethrone the venerable Flurry screensaver" - You are absolutely right. The first time I saw the screensaver, I was completely mesmerized and watched it for a few minutes before getting back to work. Out of curiosity, why Rust? Not saying anything against it, just looking to understand your take on it.
1. It absolutely had to run in the browser. 2. I wanted the option of shipping native binaries later on, e.g. screensavers
This narrows the choice to something that can compile to WASM and has bindings for WebGL/OpenGL. Rust has substantial support for these technologies, there's an active graphics community, and, personally, it felt approachable for someone without experience with C/C++.
Also, I write Haskell/Elm for a living. I don't need much convincing to pick up another typed, memory-safe language.
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#36It's taxing on CPU and GPU: normal | running screensaver in browser CPU: 5% | 15% GPU: 10% | 45%
What’s your GPU? My phone can handle the demo without freaking out so I find it hard to understand why a PC would take half its available GPU compute to do the same.
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#37What's the missing secret sauce that the anonymous apple employee alludes to? Any guesses?
1) Colors are set based on desktop wallpaper chosen by the user automatically
2) The little lines never cross at more than slightly more than parallel in the real one, but they sometimes do here
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#38Are these screensavers designed to be impressive and fun while also requiring minimal processor (battery)? I always assumed the screensavers that ship with the Mac are carefully designed not to unnecessarily drain the battery, but I realised just now that’s just an assumption.
The older ones are pretty lightweight shaders, and don't seem to tax the machine that much. Drift would heat up my Intel Mac pretty quickly though (~70c, 80c if connected to an external monitor), but presumably only because the iGPU was struggling. I'd be curious to profile the official program and see what's hogging the GPU so much...
It's a fluid simulation. Compute shaders, compute shaders, compute shaders.
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#39Earlier quoted context omitted.
The older ones are pretty lightweight shaders, and don't seem to tax the machine that much. Drift would heat up my Intel Mac pretty quickly though (~70c, 80c if connected to an external monitor), but presumably only because the iGPU was struggling. I'd be curious to profile the official program and see what's hogging the GPU so much...
> I'd be curious to profile the official program and see what's hogging the GPU so much... It's a fluid simulation. Compute shaders, compute shaders, compute shaders.
IMO the best balance would be maxing out the AVX pipeline but keeping the CPU at base clock, and then leave the rendering/framebuffer manipulation to the GPU. I suspect that running both the simulation and 5k/2k displays simultaneously is too much for the GPU to handle.
Re: Recreating macOS’s Drift Screensaver with Rust and WASM
#40Earlier quoted context omitted.
Hit "C" to bring up the control panel which, btw, is written in Elm!
Ah, the tell-tale signs of re-implementing inputs from scratch! It's not so much "hit C" as "Hit the key with code KeyC"... which means press "j" if you're using Dvorak, and something else if you're using Azerty, Colemak, or some other layout.