8 ms·
Recreating macOS’s Drift Screensaver with Rust and WASM
- totetsu 4y agoHas anyone else seen the macOS version of this bug out and look like fast moving fireworks for a moment when launching when the system is under high load?
- mlindner 4y agoLooks similiar but the colors are significantly subdued compared to the native macOS version. I guess they're only using a more limited color pallete than what MacOS uses?
- lioeters 4y agoBrowser demo: https://flux.sandydoo.me/ https://flux.sandydoo.me/
- suntuba 4y agoHit "C" to bring up the control panel which, btw, is written in Elm!
- ComputerGuru 4y agoAh, 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.
- rob74 4y agoI see it also has an "UA" mode - which is funny, because the animation reminds me of the waves you can see in a field of wheat on a windy day, and the Ukrainian flag represents a field of wheat under a blue sky. Hey, I guess that's an idea for another screensaver with a similar mechanic...
- krackers 4y agoWhat's the gist behind how the flow lines are generated? It looks sort of like the vector field for a differential equation, can we plug in our own values?
- NegativeLatency 4y agoCan’t speak to the vectors themselves but the colors on macOS are derived from your desktop image
- melony 4y agoDoesn't look like typical CFD/ODE sims but somebody more experienced in shaders can comment below https://github.com/sandydoo/flux/tree/main/flux/shaders https://github.com/sandydoo/flux/tree/main/flux/shaders
- Waterluvian 4y agoAre 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.
- smoldesu 4y agoThe 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...
- sandydooo 4y ago> 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.
- smoldesu 4y agoRight, but a lot of those shaders will run fine on the CPU as opposed to the GPU. Especially with the current lineup of supported Intel Macs, there's pretty much no supported machines that don't have comprehensive vector computation pipelines on the CPU-side of things. 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.
- CyberDildonics 4y agoGPUs are multiple orders of magnitude faster than a CPU's max theoretical throughput. If a GPU is slowing down the solution is a faster GPU, the CPU won't be able to help out much at the same stuff.
- behnamoh 4y agoIt's taxing on CPU and GPU: normal | running screensaver in browser CPU: 5% | 15% GPU: 10% | 45%
- ComputerGuru 4y agoWhat’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.
- vkoskiv 4y agoTo be fair, so is the original Drift screensaver from Apple. I only briefly used it before realising it was gobbling up tons of power and heating my laptop up.
- infogulch 4y agoI guess a screensaver is only useful if the screen startup is slow.
- zweifuss 4y agoIn a library setting they were useful to show availability. Often Users would press the power button, when the screen was blank, even if the PC was on. Boot time was longer than two minutes and the filesystems generally didn't have journaling and were prone to corruption, when rebooted that way.
- nsxwolf 4y agoWhy did screensavers ever do anything besides just blanking the screen?
- paulgb 4y agoI 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)
- bestouff 4y agoPlus early on you couldn't turn off the screen from the PC, only the physical button worked. We had to wait for VESA blanking IIRC to have something working. So either your screen was always on, or you printed moving pattern to avoid burning the phosphor.
- combyn8tor 4y agoIn the era of beige crt monitors and not caring about electricity consumption it was all the rage to personalise your screensaver. A lot of people used them to display personal pics of their animals, family, cars etc. in place of putting physical pics on the desk. In a corporate environment with uniforms people did what they could to add some flare :-)
- matwood 4y agoYep. The Matrix screensaver took over my office by storm in 1999.
- dan_hawkins 4y agoIf you worked with color (like graphics designer for example) you wanted to avoid turning off your monitor because you needed at least 30 minutes of warm up to stabilize brightness and color fidelity of a CRT. Showing anything beside blank screen indicated to you that the computer is turned on. Animation has been obvious to avoid burn in.
- etaioinshrdlu 4y agoWhat's the missing secret sauce that the anonymous apple employee alludes to? Any guesses?
- liminalsunset 4y agoMy guesses based on intuition: 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
- spk_ 4y ago"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.
- jamincan 4y agoWithout a response from the parent, I'm guessing they wanted it to be in wasm, and Rust is one of the more popular languages for wasm development.
- sandydooo 4y agoI had 2 requirements starting out: 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.
- qwerty456127 4y agoI want the original text-mode (or, perhaps even better, imitated text mode over the full-resolution graphics mode) starry night sky from the Norton Commander :-)
- speed_spread 4y agoI want AfterDark science graph generator.
- RektBoy 4y agoHoly... looking at this screensaver, this triggers some new phobia in me, I didn't know I have. Thx
- ben_ 4y agoWas hoping someone had remade this for windows, great work!
- Angostura 4y agoDrift is beautiful, but for some reason, it makes me anxious when watching it - uneasy - and I have no idea why. Anyone else?