CamanJS icon indicating copy to clipboard operation
CamanJS copied to clipboard

USE WebGL if possible ?

Open darkyen opened this issue 11 years ago • 5 comments

I think it should be possible to create a shim to run the filters in WebGL if supported and falling back to canvas. The direct advantage will be insanely boosted performance.

darkyen avatar Jul 18 '14 11:07 darkyen

I've thought about this a lot. Unfortunately my WebGL skills are pretty limited. Not sure how you would provide 100% compatibility with the current filters. A canvas can't be both a WebGL canvas and a 2d canvas as far as I know.— Ryan LeFevre (@meltingice) LayerVault Software Engineer

On Fri, Jul 18, 2014 at 7:54 AM, Abhishek Hingnikar [email protected] wrote:

I think it should be possible to create a shim to run the filters in WebGL if supported and falling back to canvas. The direct advantage will be insanely boosted performance.

Reply to this email directly or view it on GitHub: https://github.com/meltingice/CamanJS/issues/149

meltingice avatar Jul 18 '14 13:07 meltingice

There exists seriously.js - http://seriouslyjs.org/ its free and open source, The documentation is in stone age but the project is pretty robust and code is well written +1, maybe write a shim with seriously.js ? PS Seriously is lower level compared to canman

darkyen avatar Jul 22 '14 19:07 darkyen

There is no big problems with rewriting all filters to GLSL and use as another driver with Canvas fallback.

fesor avatar Jun 12 '15 11:06 fesor

Also there is glfx.

fesor avatar Jun 15 '15 16:06 fesor

Just checked, glfx already have implementation for some of the filters:

  • brightness
  • contrast
  • noise
  • sepia
  • vibrance
  • vignette
  • exposure
  • curves (need to check interpolation function)
  • gamma
  • hue
  • saturation
  • invert

What is missed here:

  • greyscale
  • channels
  • sharpen
  • posterize
  • clip
  • colorize
  • fillColor
  • clip
  • stackBlur

It's not so complicated to implement this filters. Some of them already implemented in other libraries (for example, sharpen filter)

Also blending modes should be implemented as fragment shaders. There is example: http://www.nutty.ca/articles/blend_modes/

fesor avatar Jun 18 '15 21:06 fesor