Löve "Light vs. Shadow" Engine [0.4.3]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Löve "Light vs. Shadow" Engine [Project Page]

Post by Ranguna259 » Sat Mar 08, 2014 3:54 pm

Maybe AMD is a no go, PriorBlue is there any way you can modifie the code so that it won't load this specific shader or part of the shader, maybe with a flag or something alike ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
Jeeper
Party member
Posts: 582
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Löve "Light vs. Shadow" Engine [Project Page]

Post by Jeeper » Sat Mar 08, 2014 6:20 pm

http://i.imgur.com/TjrmVoB.png

Here is the error one of friends with AMD sent me.

User avatar
slime
Solid Snayke
Posts: 2904
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine [Project Page]

Post by slime » Sat Mar 08, 2014 7:42 pm

'smooth' is a keyword in later GLSL versions. It sounds like the AMD compiler has a bug where it can't handle a variable named 'smooth' even in GLSL versions where it's not a keyword (and it's not a reserved keyword either.)

An easy fix would be to rename the variable.

szensk
Party member
Posts: 155
Joined: Sat Jan 19, 2013 3:57 am

Re: Löve "Light vs. Shadow" Engine [Project Page]

Post by szensk » Sat Mar 08, 2014 8:06 pm

slime wrote:'smooth' is a keyword in later GLSL versions. It sounds like the AMD compiler has a bug where it can't handle a variable named 'smooth' even in GLSL versions where it's not a keyword (and it's not a reserved keyword either.)

An easy fix would be to rename the variable.
this works, thanks slime.

User avatar
PriorBlue
Prole
Posts: 43
Joined: Fri Feb 28, 2014 3:46 am
Location: Munich, Germany

Re: Löve "Light vs. Shadow" Engine [0.2.0]

Post by PriorBlue » Sat Mar 08, 2014 9:41 pm

Ok, at first a few answers:
Ranguna259 wrote:...could you add rotation...
Yes, its on my TODO list.
WetDesertRock wrote:Is it possible to have a segment be a game object? ... Also, are you going to do directional light sometime?
The light engine is completely separated from the physics and "drawing stuff" part, so you just have to synchronize the shadow bodys and lights with your game. When you update the light engine, all light/shadow information's will be generated in different canvases, which you can draw over or under your scene.

Yes, directional light will be included, soon.
Error
Cannot compile pixel shader code:
Line 2: error: Syntax error: "smooth" parse error
Yes, smooth is a keyword for ATI shaders. I have changed it to "lightSmooth".

So, here are the new things, i worked on:

My first normal shader calculation wasn't that good, so i watched a few other examples and rewrote him (I hope you can see the differences :awesome: ).

Image

I have finally integrated some options to generate normal maps. So you don't need to pixel them (this options will be extended in the future). It's for now possible to generate flat/gradient normal maps, convert height maps to normal maps and use(convert) the image itself as normal map (usually gives poor results).

Normal map gradient generation:
Image

Height map to normal map generation:
Image

Here some code examples:

Code: Select all

-- generate a simple normal map, which can be only lighted from the front
lightWorldImage.generateNormalMapFlat("front")
-- generate a cone like normal map
lightWorldImage.generateNormalMapGradient("gradient", "none")
-- generate a circle like normal map
lightWorldImage.generateNormalMapGradient("gradient", "gradient")
-- Set the height map of the object. The normal map will be automatically generated with the given strength.
lightWorldImage.setHeightMap(imgHeight, 2.0)
-- The normal map will be automatically generated from the image.
lightWorldImage.generateNormalMap(2.0)
Shadow color and alpha (glass):
Image

Code example:

Code: Select all

-- set the object half transparent
shadowObject.setAlpha(0.5)
-- give the shadow body a color
shadowObject.setColor(255, 0, 0)
More informations can be found on the Wiki.

User avatar
Davidobot
Party member
Posts: 1191
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: Löve "Light vs. Shadow" Engine [0.2.1]

Post by Davidobot » Sun Mar 09, 2014 6:41 am

This is just so goood. Thank you so much for making this :awesome:
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

WetDesertRock
Citizen
Posts: 67
Joined: Fri Mar 07, 2014 8:16 pm

Re: Löve "Light vs. Shadow" Engine [0.2.1]

Post by WetDesertRock » Sun Mar 09, 2014 7:09 am

What I found is that the shapes don't go into total darkness when cast into shadow. If you move the mouse away, things will get darker, but not when they are in shadow.

http://imgur.com/yXBlRk5

User avatar
Jeeper
Party member
Posts: 582
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Löve "Light vs. Shadow" Engine [0.2.1]

Post by Jeeper » Sun Mar 09, 2014 10:06 am

WetDesertRock wrote:What I found is that the shapes don't go into total darkness when cast into shadow. If you move the mouse away, things will get darker, but not when they are in shadow.

http://imgur.com/yXBlRk5
In order to make the "shadows" darker, you need to lower your values in the "yourVariableName.setAmbientColor(90,90,90)". If you want the shadow to make your boxes darker, you need to draw the boxes FIRST and then draw the shadow.

User avatar
PriorBlue
Prole
Posts: 43
Joined: Fri Feb 28, 2014 3:46 am
Location: Munich, Germany

Re: Löve "Light vs. Shadow" Engine [0.2.1]

Post by PriorBlue » Sun Mar 09, 2014 6:18 pm

WetDesertRock wrote:What I found is that the shapes don't go into total darkness when cast into shadow. If you move the mouse away, things will get darker, but not when they are in shadow.
I know, the shadows are working with a stencil system at the moment, so i can't separate which object is over or under the shadow of another object. I hope i can change this in the future.

So and i polished the glow system, its now a little bit sharper:
Image

And i added a glow functionality to standard circle/poly objects (Press "8" and "9" in the demo):
Image

Here the code for the glow effects:

Code: Select all

-- set the global blur of the glow effect (default: 1)
lightWorld.setGlowStrength(4)
-- add glow to the shadow body
shadowBody.setGlowStrength(1.0)
-- set glow color of the shadow body
shadowBody.setGlowColor(255, 0, 0)
Last edited by PriorBlue on Sun Mar 16, 2014 1:22 am, edited 2 times in total.

User avatar
Snuux
Prole
Posts: 49
Joined: Sun Dec 15, 2013 10:43 am
Location: Russia, Moskow
Contact:

Re: Löve "Light vs. Shadow" Engine [0.2.2]

Post by Snuux » Sun Mar 09, 2014 8:37 pm

It's fantastic! Really wery awesome! Please, give me some advice about better way, to learn shaders?)
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests