LambdAurora / LambDynamicLights

A dynamic lights mod for Minecraft on Fabric Loader.
https://modrinth.com/mod/lambdynamiclights
Other
400 stars 98 forks source link

Dynamic Lights Update Very Slowly #95

Closed sylv256 closed 10 months ago

sylv256 commented 2 years ago

Describe the bug

At around 120 to 144 Hz, dynamic lights (such as torches) begin to stutter when in motion. I assume this is because dynamic lights update below the refresh rate. Apparently it's because dynamic lights update extremely slowly. This is especially noticeable at 120 Hz and higher. Is there a better way to update lights than rebuilding chunks every single time there's a dynamic light update?

To Reproduce

Steps to reproduce the behavior:

  1. Set your monitor's refresh rate to 144 Hz.
  2. Adjust Minecraft's maximum FPS (VSync is also affected).
  3. Hold a torch.
  4. Walk or run.

Expected behavior

The refresh rate of dynamic light updates should at least the monitor's refresh rate.

Demonstration

https://www.dropbox.com/s/t0eyzw76z0e15ee/2021-12-18%2020-11-48.mp4?dl=0 (make sure to download the video so it plays at 144 Hz)

Desktop (please complete the following information):

Additional context

You must have a 144 Hz or higher monitor to test this!

sylv256 commented 2 years ago

This should probably have a "question" tag.

LambdAurora commented 2 years ago

Please test this version of the mod: https://cdn.discordapp.com/attachments/734888845346078741/924456425823039528/lambdynamiclights-2.1.1limitless1.18.jar

It removes one limiter, since I do not have any displays with a framerate higher than 60Hz, I cannot test myself.

LambdAurora commented 2 years ago

A friend tested the fix and it appears to fix it, and it doesn't seem to decrease performances, so the fix will be applied for next release.

lizfinite commented 2 years ago

I've been running the limitless jar in my modpack and it persists unless I turn on "defer chunk updates" in sodium's options. This effectively eliminates the stutter while holding an item with dynamic lighting enabled.

Tried to capture a video but it doesn't really do it justice. https://youtu.be/QDR1IVlv7Gc

Legatum1 commented 2 years ago

You could disable Defer Chunk Updates if you do have Sodium, however you would start to see some noticeable frame drops. On the other hand, you could leave it on and increase the Chunk Update Threads so it can update more frequently.

sisby-folk commented 2 years ago

Just copying over what I mentioned in my duplicate issue and adding some more info.

I'm running on the 2.1.0 on 1.18.2 with iris and sodium here. Here's some frame timings, all are walking.

No Lantern image

Lantern image

Lantern + "Always Defer Chunk Updates" image The frametimes here are better, but visually I can see that the lighting updates themselves are not every frame.

Moving onto the "Limitless" version

No Lantern image

Lantern image It feels like there's a microstutter here, but it doesn't hurt my eyes nearly as much as 2.1.0 - this one just feels like the game is microstuttering like a normal game would.

Lantern + "Always Defer Chunk Updates" image Smoothest of the lot. Definitely an improvement.

I think this squarely fixes the issue described here, however there's something about playing this way that still makes me feel a little bit like i'm staring at a flourescent light - way less than before, but still a touch. It could be possible that my machine just isn't up to scratch, or there's some completely seperate nigh-insolvable minor lighting flicker issue. I really can't tell.