cansik / processing-postfx

A shader based postFX library for processing.
148 stars 13 forks source link

Add more shaders to the library #3

Closed cansik closed 7 years ago

cansik commented 7 years ago

Add more default shaders to the library:

Color

Reconstruction

Effects

b2renger commented 7 years ago

Hi this is a great idea for a library

I was wondering about blending shaders would be in the scope of this lib ?

Sometime ago I played with blending shaders and got a little processing app to experiment with different kind of blending : https://github.com/b2renger/Processing_Blends_Shaders

The code is not really good and I always thought I should find a way to refactor those. Your post-fx lib seems perfect for this job. Would you be open to me working on that ?

cansik commented 7 years ago

@b2renger Yep sounds like a good idea. I think some blending shaders are already implemented in processing:

blendMode(BLEND);

But I will check out your blending shaders 👍

cansik commented 7 years ago

Ah ok, now I know what you mean with blending shaders :) Yeah I will check out your shaders.

b2renger commented 7 years ago

@cansik I was not aware of the blendMode() function, before I used blend(). I think blend() was computed on the cpu, It looks like blendMode still computes from arrays of pixels in java https://github.com/processing/processing/commit/1ff98f928a31334a003cb567a6febae4736a4a31

maybe a faster implementation with shaders could be cool, let me know what you think. (I didn't write those shader myself, sadly I'm not capable of doing so, yet :) )

b2renger commented 7 years ago

@cansik , ok then maybe it's not usefull to bother with blends then. Let me know what you decide, and If you think I can help I'd be glad to do so.

cansik commented 7 years ago

The problem is that we are using P3D and P2D textures and set the blend mode there. And I think because of that, it will be done with the compositing methods of OpenGL, but I will check that :)

How do you think, should the API look like for the blend modes with this library? Something like that:

PGraphics texture1;
PGraphics texture2;

fx.render(texture1)
        .brightnessContrast(0.1f, 1.0f)
        .blend(BlendMode.SCREEN, texture2)
        .compose(passResult);

If we really implement it here :)

b2renger commented 7 years ago

Yes definitely something like that !

cansik commented 7 years ago

I've implemented now a lot of useful shaders (about 11). I think that's enough for the current version ;)