Page 1 of 1

PixelEffect vs MapPixel (a cry for pixeleffect enlightenmen)

Posted: Thu Mar 15, 2012 3:13 pm
by timmeh42
I'm currently trying to take a greyscale image and turn it into pure black and white every draw event.

Idon't know much about the way I should do this, but I think it should either be done by drawing to a framebuffer (or canvas), getting the framebuffer's imagedata, and then using a MapPixel function on the image data. This seems to be the easier method, as the color values are easy to manipulate, but I need to perform the mapping every draw event, and imagedata (or making a new image from it) specifically says that this isn't a good idea.

The second option seems to be using löve 0.8.0 and using PixelEffect, which appears to be much more speed-friendly. However, the wiki shows next to nothing on how to use these.

Therefore, could someone in the know please provide me (and other rookies) with some help or enlightenment on how to use PixelEffect?

Re: PixelEffect vs MapPixel (a cry for pixeleffect enlighten

Posted: Thu Mar 15, 2012 3:34 pm
by kikito
timmeh42 wrote: turn it into pure black and white every draw event.
Can't you store the black and white version somewhere, and just calculate it once, instead of on every draw event?

Re: PixelEffect vs MapPixel (a cry for pixeleffect enlighten

Posted: Thu Mar 15, 2012 3:53 pm
by timmeh42
Unfortunately not as the image (image? canvas? dunno what to call it) is dynamic; also, this isn't for merely a cosmetic effect as its used as an alpha mask for another image or texture.
I have already achieved the effect in GameMaker, but it used a rather hack-ish way (repeated drawing with a "dodge" blend mode as far as I remember), and I wanted to port it to Löve.

Re: PixelEffect vs MapPixel (a cry for pixeleffect enlighten

Posted: Thu Mar 15, 2012 6:11 pm
by richapple
I didn't know anything about pixeleffects too, but then found this thread:
Share a shader!

I have to say it's a great thread with very good examples! I learned quite much about shaders even though I knew nothing.

Re: PixelEffect vs MapPixel (a cry for pixeleffect enlighten

Posted: Thu Mar 15, 2012 6:46 pm
by timmeh42
Ah thanks very much. Didn't find it when i searched because I searched for the wrong terms...
On the other hand, oh poop. One of the shaders does exactly what I intended, and better (the metaballs one). Oh well ^^