## Shädows (A light engine)

DeNick
Prole
Posts: 4
Joined: Wed Aug 01, 2018 5:23 pm
Location: Russia

### Re: Shädows (A light engine)

MissDanish wrote:
Sat Nov 17, 2018 3:45 am
zorg wrote:
Fri Nov 16, 2018 6:08 pm
DeNick wrote:
Fri Nov 16, 2018 3:19 pm
It's not quite what I need. Updated the link to the video.
You are limiting what gets actually rendered, right? and you're not rendering things outside of the visible viewport, right? Because that can eat tons of extra processing that could be avoided.
If you are referring to the actual lights that shouldn't be an issue since I actually helped make sure nothing unnecessary is rendered when the lights are not in range. It even destroys the canvases when it's out of range (the part I helped with).
The fact is that when I add a motion to an object in love.update, FPS immediately drops to 200-250 (before that it was about 700-800). When adding a new lighting FPS even more begins to fall. The movement of the object I do as follows:

Code: Select all

	local x,y = newBody2:GetPosition()
newBody2:SetPosition(nx,750)

if (x >= 700 and move) then
nx = nx + 0.5
move = true
if (nx >= 900) then
move = false
end
end

if (x <= 900 and not (move)) then
nx = nx - 0.5
move = false
if (nx <= 700) then
move = true
end
end

Starkkz
Prole
Posts: 24
Joined: Thu Jul 16, 2015 7:24 pm

### Re: Shädows (A light engine)

It's very likely that the problem you're facing is the softness shader being applied to every particular light. You can disable that effect by setting the Light.Blur to false.

DeNick
Prole
Posts: 4
Joined: Wed Aug 01, 2018 5:23 pm
Location: Russia

### Re: Shädows (A light engine)

Starkkz wrote:
Sat Nov 17, 2018 2:48 pm
It's very likely that the problem you're facing is the softness shader being applied to every particular light. You can disable that effect by setting the Light.Blur to false.
OMG. I could not find the problem for so long. Thank you very much!

Starkkz
Prole
Posts: 24
Joined: Thu Jul 16, 2015 7:24 pm

### Re: Shädows (A light engine)

MissDanish
Citizen
Posts: 65
Joined: Wed Mar 07, 2018 11:21 pm
Location: Denmark

### Re: Shädows (A light engine)

Would you be willing to add square lights to Shädows?
Provides free hugs

Starkkz
Prole
Posts: 24
Joined: Thu Jul 16, 2015 7:24 pm

### Re: Shädows (A light engine)

MissDanish wrote:
Tue Nov 27, 2018 10:14 am
Would you be willing to add square lights to Shädows?
Sorry for the late answer. I'm a bit curious to know how can you possibly cast a shadow from a light source that has the shape of a square, I understand that this is totally possible but I haven't tried this before, I will try to find some articles about this.

MissDanish
Citizen
Posts: 65
Joined: Wed Mar 07, 2018 11:21 pm
Location: Denmark

### Re: Shädows (A light engine)

Starkkz wrote:
Sat Dec 15, 2018 1:42 am
MissDanish wrote:
Tue Nov 27, 2018 10:14 am
Would you be willing to add square lights to Shädows?
Sorry for the late answer. I'm a bit curious to know how can you possibly cast a shadow from a light source that has the shape of a square, I understand that this is totally possible but I haven't tried this before, I will try to find some articles about this.
No it's okay, I am just glad to get any kind of response. It would actually theoretically improve the performance of my game since I have to do some not so great tricks to achieve square shapes for windows and neon signs. What I do currently is to make a rectangle out of multiple round lights which is not good for performance as intersecting lights from my understanding harm performance quite a lot. It would also give off a much more more convincing effect with windows and monitors I think.

EDIT: also while you're at it you should also consider adding cone lights like the Light vs Shadow library, should be an easy addition if you do it like that library did it.
Provides free hugs

Starkkz
Prole
Posts: 24
Joined: Thu Jul 16, 2015 7:24 pm

### Re: Shädows (A light engine)

Out of curiosity, does a rectangular light source even cast a shadow on a body? Since it's from a top-view perspective, the center of the rectangular light source is all around the shape, then the intensity of the light is equal in all of the shape's area, the projected shadow would appear under the body, but since it's a top-view perspective, the casted shadow wouldn't be visible at all.

The only variable I see here is the distance of the rectangular light source from the ground. That would lower the intensity of the rectangular light source.

Is this what you need?

MissDanish
Citizen
Posts: 65
Joined: Wed Mar 07, 2018 11:21 pm
Location: Denmark

### Re: Shädows (A light engine)

Starkkz wrote:
Sun Dec 16, 2018 5:22 pm
Out of curiosity, does a rectangular light source even cast a shadow on a body? Since it's from a top-view perspective, the center of the rectangular light source is all around the shape, then the intensity of the light is equal in all of the shape's area, the projected shadow would appear under the body, but since it's a top-view perspective, the casted shadow wouldn't be visible at all.

The only variable I see here is the distance of the rectangular light source from the ground. That would lower the intensity of the rectangular light source.

Is this what you need?
I personally don't use the shadows, just the lights.

I'd like something roughly like this (tried to simulate it as best as possible in paint.NET), which is what you described I think
Untitled.png (6.25 KiB) Viewed 2744 times
Provides free hugs

Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm

### Re: Shädows (A light engine)

Hi there! I've started to use this library in my project. I'm using love.physics and the latest version of love too.

I'm having a with shadows not rotating with the physics body that they are associated with after creating a body, shadow, and then calling body:TrackPhysics(myPhysicsBody).

I've only tested it on polygon, height, and normal shadows, and they all seem to have the problem of not rotating with the physics body (in this case a rectangle).

In addition to not rotating to match the physicsBody's angle, when a normal shadow or height shadow is attached to a body and that body is trying to TrackPhysics of a physics body, the shadow becomes anchored to the center of the physics body, which has the affect of the shadow not properly "squaring up" with they actual physics body. I've been trying to resolve these problems myself in the library but it's a little difficult and it would be best if they were solved properly by the author I think.

### Who is online

Users browsing this forum: No registered users and 5 guests