3 ms·
Thank you! Man, if you could get people who work on UIs to write a shader once in their software career and tell them, hey how do you get a nice Gaussian blur t
by andrewmcwatters 3y ago
Thank you! Man, if you could get people who work on UIs to write a shader once in their software career and tell them, hey how do you get a nice Gaussian blur to draw fast on a 4/5/8k monitor, they'll quickly realize you need to do as little drawing as possible.
- rerdavies 3y agoThey'd probably answer: you need to be using 2D FFT convolution. ;-P
- rikroots 3y agoWhen I was searching for a very fast Gaussian blur algorithm to implement into my 2d canvas library, I stumbled across some code[1] which does a magnificent job by using something called an Infinite Impulse Response[2] filter - something that comes from the world of audio, I believe? The best bit from my POV is that the work is all done on the CPU with no need to care about webGL/shaders/etc. [1] - https://github.com/nodeca/glur/blob/master/index.js https://github.com/nodeca/glur/blob/master/index.js [2] - https://en.wikipedia.org/wiki/Infinite_impulse_response https://en.wikipedia.org/wiki/Infinite_impulse_response
- kuschku 3y agoGaussian blur is "easy", you can decompose it into a vertical and horizontal component and parallelize and vectorize most of the task. But that's a special case. If you have to actually fill the buffer the traditional way, it takes an eternity. Which is why I'm so disappointed by Gtk's decision to say "just draw at 6K at 2x if you want 4K at 1.5x, scaling is cheap". Because it's definitely not.