evanw / glfx.js

An image effects library for JavaScript using WebGL
https://evanw.github.io/glfx.js/
MIT License
3.26k stars 402 forks source link

add barrel/lens distortion filter from existing implementation? #38

Open jywarren opened 7 years ago

jywarren commented 7 years ago

I found this implementation of a barrel distortion (also known as lens distortion) filter using WebGL here:

https://github.com/bluemir/fisheye-correction-webgl

I forked it and got a demo running in Github Pages: https://jywarren.github.io/fisheye-correction-webgl/

It's pretty simple and includes shaders: https://github.com/jywarren/fisheye-correction-webgl/tree/master/shaders

I'm curious -- I'm not a WebGL programmer, but it'd be really great if this could be integrated into a more standardized suite of filters such as glfx.js. Is anyone able to help adapt it?

Demo screenshot below:

screenshot 2016-11-27 at 11 10 27 pm

jywarren commented 7 years ago

I found another implementation here, which seems also reasonably self-contained, though not quite as nice:

http://marcodiiga.github.io/lens_distortion_filtering/

jywarren commented 7 years ago

I ended up adapting the first project into a stand-alone library here: https://github.com/jywarren/fisheyegl

It's quite a bit more modular, and could be integrated into this project -- i'll probably release an npm module from it. Thanks!