processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.48k stars 3.29k forks source link

Need a filter(NORMAL); option #3931

Closed ricardocanada closed 4 years ago

ricardocanada commented 5 years ago

Nature of issue?

Most appropriate sub-area of p5.js?

Which platform were you using when you encountered this?

Feature enhancement details:

Once a filter is set on an image, there is no way I know of to remove it for other images displayed afterward. A variation named " filter(NORMAL); " could serve this purpose.

outofambit commented 5 years ago

hi @ricardocanada thanks for writing this up. to make sure i understand,

remove it for other images displayed afterward

does this mean you are reusing a p5.Image and giving it a new source image? and you'd like to have a way to unset the filter? i think that might be achieved by using an if statement to not call .filter on that image afterwards?

if you have a code snippet to share that would be very helpful. thanks!

ricardocanada commented 5 years ago

You could look at the actual sketch on OpenProcessing and make a fork to test it. https://www.openprocessing.org/sketch/742391

I was playing with it for a while tonight, and my request may be pointless, because even one filter on a webcam capture requires so much processing that if I try to put different filters on four different video windows, the program becomes quite choppy and erratic. But let me know if you have any suggestions.

Thanks,

Richard

On Aug 4, 2019, at 5:34 PM, evelyn masso notifications@github.com wrote:

hi @ricardocanada thanks for writing this up. to make sure i understand,

remove it for other images displayed afterward

does this mean you are reusing a p5.Image and giving it a new source image? and you'd like to have a way to unset the filter? i think that might be achieved by using an if statement to not call .filter on that image afterwards?

if you have a code snippet to share that would be very helpful. thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lmccart commented 5 years ago

this makes sense to me. once you've set a filter, you can change it, but you can't turn it off completely. it's basically a noFilter() option we're looking for. though I think filter(NORMAL); syntax feels most natural.

aatauil commented 5 years ago

I have the same problem filter(BLUR, 0) does not seem to be working either strangely enough. Trying to make a cookie clicker game and filter(BLUR, 4) blurs everything instead of only the specific object I want it to blur..

lmccart commented 4 years ago

Thanks for posting @ricardocanada. We've looked into this and it turns out it's actually quite hard to implement. We are not going to be able to implement this at this time, due to other priorities we have leading up to the 1.0 release, perhaps we can revisit in the future.

RalenArc commented 2 years ago

I got this workaround if anyone is still facing this issue. function setup() { createCanvas(400, 400); background(0); rectMode(CENTER); fill(255,0,0); rect(width/2,height/2,50,50); pg = createGraphics(width,height);

push() pg.stroke("#00ffff"); pg.strokeWeight(5); blendMode(SCREEN); pg.line(0,height/2, width, height/2); pg.filter(BLUR, 4); image(pg, 0,0); pop() }

Here's what was happening before: before

And after: after