Page 1 of 2

Spotlights: TREMENDOUS slowdowns

PostPosted: Thu Jan 25, 2018 9:58 pm
by Major Cooke
  • Download this.
  • Load MAP01, warp 1702 2096.
  • "give FlashlightToggle" in console.
  • Face the crates to the right and watch your computer curl up into the fetal position.

Yes, this is a stripped down version of the map, so ignore all missing entities and textures. They're not needed. I left all level geometry in there untouched -- didn't want to go screwing with that as that may affect testing performance.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 12:10 am
by Rachael
This seems like a game sim processing issue. When the game is paused the frame rate issues go away.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 12:59 am
by Major Cooke
Holding still will increase FPS too. But not by much. Still if needed, it can be moved to somewhere more appropriate.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:01 am
by dpJudas
I'm willing to wager that this also happens with normal lights and that you're using moving a light around with a very large radius (don't have time to look at the mod right now).

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 11:07 am
by Graf Zahl
That light is wayyyyyy too large for the engine to handle efficiently. With a map this detailed the subsector linking for each movement will take its toll.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 12:58 pm
by Major Cooke
Huh... I guess spotlights have a smaller range then, in general?

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:03 pm
by Caligari87
The performance impact is actually the same as a normal dynamic light but the radius needs to be much higher to appear visually right because we expect spotlights to reach farther than point lights. The problem is that spotlights still "look all around" for affected linedefs even if they generally only illuminate a small portion of them.

I presume the fix would require only looking for linedefs that coincide with the light's cone.

8-)

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:06 pm
by dpJudas
That's correct, Caligari87. However due to portals I didn't feel comfortable trying to improve the light link function without having a 100% understanding of how it links. This kind of function is not one you want to break by doing something careless.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:23 pm
by Graf Zahl
What you definitely can do is to stop at segs which are completely outside the cone, provided that this can be done quickly.

Anyway, if you got an idea how to improve performance of creating all the light lists, be my guest.
The algorithm was originally from ZDoomGL, although that original was even more inefficient that what's there now.
In the end this is just one of those things where the Doom engine does not mix well with modern rendering effects

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:28 pm
by dpJudas
Graf Zahl wrote:What you definitely can do is to stop at segs which are completely outside the cone, provided that this can be done quickly.

That's what I had in mind, but the angles you check for changes if the seg it crosses is a portal. Not an unsolvable problem, but I didn't feel like attacking it at the time. :)

Edit: or hmm, does it?

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 1:51 pm
by Graf Zahl
I knew these arbitrarily angled portals were a bad idea from the start but imagine I had removed them. Can you imagine how people might have reacted...? :twisted:

It should be doable, though. If these portals are handled (I cannot remember if I skipped them), the light needs repositioning anyway so doing the needed rotation as well shouldn't be the issue.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 2:04 pm
by Major Cooke
Only for Static (Eternity style) portals does the GL lights transfer over. In this example the lines are not static.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 2:11 pm
by Graf Zahl
That should make this here a bit easier.
Now I remember why I left them out. Getting the links is not the issue - the real problem is to get the proper location for the light after the portal transformation because this requires the offset table that's only available for static portals.

But here's another question that just came up. How does the shadowmap handle portals if some linedef is between the relocated light and the area affected through the portal?

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 2:13 pm
by Major Cooke
It does this with shadowmapping turned on. Turned off, it behaves normally.

EDIT: It's the same for both sides so it depends on the hidden room's depth. Huh...

EDIT 2: Forgot to attach the updated portals.wad. I only changed the two lines directly though, I didn't bother with the rest of them.

Re: Spotlights: TREMENDOUS slowdowns

PostPosted: Fri Jan 26, 2018 2:43 pm
by Rachael
Yeah Cooke is right - only static portals will transfer dynamic lights, and static portals can only face the same direction as their origin. So you can safely clip away everything that's too far out of the spotlight's aperture and it'll still be portal-safe.