Spotlight drops FPS dramatically (up to 90 fps drops)

Hello,

Our development team have encountered a potential engine bug while making a flashlight system.
We had never experienced this before in any other projects we’ve worked on.

The flashlight works by simply creating a part with a spotlight and while using RenderStepped, sets the part’s CFrame to the camera’s CFrame. And once activated again, just disconnects the connection and deleted the part.
I have tested the same exact code on another project with another game and the FPS was steady and didn’t change. So this must be that the map is more highly detailed and bigger?

In the game where the issue occurs

This is how the frame rate looks normally (100 - 140+) without the flashlight:

And this is how it looks like when the flashlight is turned on (~90 frame dropped):

Video of the occurrence

In another place

Flashlight off:

Flashlight turned on:

This is the place: NYCTOPHOBIA DEV
If needed, I can provide more information.

Adding, we found that the map is the cause. So apparently spotlights in the detailed map make fps drop drastically. That should be fixed.

Edit: the place is private as this originally was a private message to the bug report team.

4 Likes

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

Does the SpotLight have .Shadows enabled? This can cause a significant performance loss if there are too many objects casting shadows, as they have to be rendered twice, once for the player to see and once for the light source to figure out what should be casting shadows. You can combat the extre rendering by reducing the .Range and .Angle of the SpotLight.

Just following up on this thread to see if this is still an issue for you! What others have mentioned in this thread is correct; if your spotlight has shadows enabled the cost of rendering the light can increase significantly if it moves around every frame (which it sounds like it does), especially in Future lighting mode.

Yup, still is a performance issue. I suppose for now we can go around with just disabled shadows.

Does turning off shadows fix the entire fps issue?

I can verify if needed if you send an rbxl file with a quick repro video through private DM, otherwise feel free to mark this closed as well.