Skip to content

futuun/dszcz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create rain overlay on your mac!

preview.mp4

How does it work?

Overlay window is rendered on the main screen and always moves to active space. Everything is covered, but mouse events are not being captured.
ScreenCaptureKit allows streaming desktop content, and since it captures frames before composition, anything can be excluded from the output (in our case overlay window is ommited). Frames are saved into Metal texture in near real time and since it's rendered in the overlay that is ignoring mouse events, user can freerly interact with system underneath.
Since overlay is MTKView it can be freerly manipulate before being shown to the user (in our case rain texture is used to render ripples and distort the screen feed.

Rain effect itself is really old trick, this is pretty good explanation how it works, you can follow rainTexture to see how it's used here.

Performance

Content presented to the user is at most 1 frame old, it takes less than 1ms to render 4k frame on my M1 Max so in theory even 480hz display wouldn't leg behind (at great cost to GPU & CPU of course).

Why?

As a kid I was using ubuntu (8.04) with compiz-fusion. It would crash often on my radeon x1050, but I kept it for all the awesome effecs. Especially rain. It's been a while since I've used linux and I'm not thinking of switching back, but I wanted some nostalgia.

About

Rain ripples overlay on macOS!

Resources

License

Stars

Watchers

Forks