matiasah / shadows

Shädows - A Shadows & Lights engine for löve

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Normal maps support

Sungray opened this issue · comments

Hi, thanks for your great effort, I really appreciate it :)

Do you plan to support normal maps ? Point being to have a correct illumination of the sprites.

Yesterday I tried to implement it but I did not have any success, I appreciate any help.

Certainly, I'll probably give it a go in a few days.

I tried to implement a basic normal map shader but it's not accurate, it doesn't even render the light on the correct position. So as I said, any help is accepted.

It seems that I have managed to make a normal map class, you just require to give it a light world and a normal map image.
Would be nice if you told me that this suits your needs so that I can close the issue.

Checked it out on the demo file, seems very good ! Thanks ! :)

Unfortunately, got an issue with the normal maps.

Instead of

nm = NormalMap:new(LWorld, love.graphics.newImage("normalmap.png"))
nm.Image = love.graphics.newImage("texture.png")
nm:SetPosition(500, 500)

I want to draw the images by myself (using quads/spritebatches). So I just need to do this :

nm = NormalMap:new(LWorld, love.graphics.newImage("normalmap.png"))
nm:SetPosition(500, 500)

Unfortunately in this case, the normal map is drawn BEFORE the image apparently, so there's no effect drawn over the image.

It's drawn after the image, check love.draw on the demo.

nm.Image was just used to simplify containing the image somewhere, it's not used in the actual code of the library.

I see thanks, must be a bug from me then :).