How would you go about reseting a filter applied to an image?

edited January 2014 in GLSL / Shaders

I'm relatively new to Processing, and as a "for fun" project I've been working on a 3D game. In this game, I have objects, shapes, using graphics that modify images for their textures. What I am trying to do is as the camera gets farther away from a shape, the shape becomes more blurred. The distance calculation is not what is giving me trouble, but rather getting the shape to become clearer after coming back to it. This could be something very simple I am just not seeing, but nonetheless I am not seeing it.

I have tried using the preset BLUR in filter(), and in draw() just changing the factor(ex: image.filter(BLUR,factor)), but that lags things up on my comp. I have tried using the blur.glsl from the examples and that is much faster, but I cant figure out how to reset the filter or remove it after it has been applied to the image, since you are unable to set a factor when using a custom shader.

Any help is appreciated. Thank you.

Answers

  • Hi, I don't know exactly how you are using filter(PShader) function, but in principle it is enough to simply not call it in order to have the scene renderered normally (i.e., without the filter applied on it). The EdgeFilter example under the Topics|Shaders shows how to enable/disable a filter. If this doesn't help, post the code showing the use of filter() in your sketch, and I will take a look.

  • Sorry, my USB holding the program we were discussing was broken a few days after your comment :( I lost motivation to code for a while after that. But recently I spent a lot of time recreating what I made and this part of it was not exactly high priority, but I'm almost done rewriting what I did, so I will be getting to this section soon. Will post code when it is rewritten, if I don't figure it out while doing it again ;)

Sign In or Register to comment.