Hey guys, I have been working on migrating some computer vision processes to WGSL and decided to take a short detour to build a proof of concept.
The shader chain uses Sobel edge detection and Optical Flow to process camera input data and convert motion within the frame to flow vectors for the fluid. I have been working to optimize it and it runs, for the most part, at 60+fps on most mobile platforms. The fluid shader will detect desktop and add a few additional layers of processing, for shaping and esthetic, but I am pleased enough with the appearance of the mobile result. I added a camera switch and some sliders for tuning the fluid effect, and allowing for playback; something akin to an animated filter (which shows a 4:5 frame by default).
In order to tune the simulation I added some interfaces for the vision inputs (sobel and of), and you can tune them and see how they effect the end result (controllers store data between sessions).
I am hunting down some performance issues in iOS, which appear to be related to texture resource syncing in the fluid effect; refresh seems to handle it, but I only have an iPhone 13 to test on and would be interested to hear your experience. Please also bear with the load times (first load is about 4-5s) as I figure out some shader decryption work which will make that faster.
Let me know how it goes, and particularly if you find any bugs or issues.
Robert
You need WebGPU and it’s unlikely that mobile devices older than a few years old are going to run it