Page 1 of 1

Per-Pixel Graphics (Retrieve Pixel Data from Image) Shader

Posted: Wed Aug 18, 2010 1:05 am
by McP
Did a search and found a somewhat vague answer
and i fear i already know the answer but ......

is there anyway to retrieve pixel information from a loaded image, for a pixel shader, normal map combo

thanks, if not any tips for getting lighting to work

Re: Per-Pixel Graphics (Retrieve Pixel Data from Image) Shad

Posted: Wed Aug 18, 2010 4:15 am
by knorke

Re: Per-Pixel Graphics (Retrieve Pixel Data from Image) Shad

Posted: Thu Aug 19, 2010 7:57 am
by Geti
You can get a screenshot with love.graphics:getScreenshot() or something along those lines. Problem is that it's HORRIBLY laggy. You can use MapPixel on individual sprites, but there is not real access to the drawbuffer ;-;

Re: Per-Pixel Graphics (Retrieve Pixel Data from Image) Shad

Posted: Thu Aug 19, 2010 9:18 am
by kikito
Mmm...

It seems to me that you can't really do them right now unless you use an external library.

(forum search is awesome)

Re: Per-Pixel Graphics (Retrieve Pixel Data from Image) Shad

Posted: Sun Aug 22, 2010 8:46 pm
by McP
Thanks for all the replys, i also got a pm from rhezalouis who told me to use ImageData (Duh)

anyway i never though of searching for shaders, i mustn't have searched all the forums

anyway ive got phong lighting working at the amazing speed of 2 fps (131,072 sqrt's per frame) (Could be used as dynamic but not realtime, if you get me)
very very basic implementation, with no attempt of optimisation

http://dl.dropbox.com/u/926983/Lighting.love
(Ill be updating it, so best use dropbox instead of forum)

It is based on this website
http://29a.ch/2010/3/24/normal-mapping- ... canvas-tag

The Face image is also in the zipped .love file, just rename it (Remove first character 'F')
Also change the material settings, you can get some real nice looks
Ambient,Specularity,Shiny

I have several ideas on optimising, and making the effect a bit better

Thanks for the help, and im reading Shaders and FBOs, so hopefully things get alot better

Re: Per-Pixel Graphics (Retrieve Pixel Data from Image) Shad

Posted: Sun Aug 22, 2010 8:52 pm
by Felipe Budinich
Wow this is amazing mate. Just a "little" slow, but amazing!