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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
McP
Prole
Posts: 4
Joined: Sat Aug 14, 2010 1:54 am

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

Post 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
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

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

Post 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 ;-;
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

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

Post 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)
When I write def I mean function.
McP
Prole
Posts: 4
Joined: Sat Aug 14, 2010 1:54 am

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

Post 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
Last edited by McP on Sun Aug 22, 2010 8:59 pm, edited 1 time in total.
User avatar
Felipe Budinich
Citizen
Posts: 67
Joined: Thu Jul 29, 2010 1:36 pm

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

Post by Felipe Budinich »

Wow this is amazing mate. Just a "little" slow, but amazing!
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests