Loading...
Logo
Processing Forum

Kaleidoscope Effect

in General Discussion  •  Other  •  1 month ago  
Alright, I've been trying in vain to create a dynamic kaleidoscope (able to change the reflecting pattern on the fly). I'm using a movie file and basically trying to take half of the image with PImage and flip it, resample that image and flip it again, but I just can't get it working, and also it's very slow. If anyone has any tips on how to get this going efficiently I'd really appreciate it!!

Replies(5)

Also see: https://forum.processing.org/topic/how-to-mirror-the-left-half-of-the-canvas

You can use the pixel array. To speed this up you can move as much calculations as possible into LUT's.
See: http://amnonp5.wordpress.com/2011/08/21/striate-cortex-advanced-pixel-manipulation/

A faster solution is to use texture coordinates on a single image.See the DynamicTexture2D example from this tutorial: http://www.creativeapplications.net/processing/geometry-textures-shaders-processing-tutorial/

Another fast solution is to use a fragment shader. In Processing 2.0 you can use the filter() method to apply a fragment shader to the whole window.

Thanks so much for the resources, I've seen your tutorials before but they look a little intimidating!! Where can I find details on the fragment shader? I'm not really seeing it anywhere in the documentation and it sounds like that's really what I need here.
Ohhhh my... INFORMATION OVERLOAD. I spent all day looking at all of those articles and the only thing I'm left with is- ugh.

I've scaled back my idea, I'm going to create the kaleidoscope look in After Effects, load the video in Processing and use different shapes as masks to reveal it. What is the best way to go about this? Because creating a PImage for each frame of the movie is incredibly slow.

As soon as I start creating PImages my frame rate drops to about 8fps. This needs to be projected live, and will be reacting to audio live, so if anyone has tips on a relatively easy way to do this while maintaining like 20-30fps please let me know! I'm willing to explore the texture thing if it supports video as input
I would seriously look into the texture thing, as you should be able to use a video as a texture.
After all, a video is just one image after another.
Instead of displaying those images, you can use it as a texture instead, and draw 8 triangles with it.
This shouldn't really run any slower than the video normally would...