Dynamic Lights Update Very Slowly
sylv256 opened this issue ยท 6 comments
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:
- Set your monitor's refresh rate to 144 Hz.
- Adjust Minecraft's maximum FPS (VSync is also affected).
- Hold a torch.
- 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):
- OS: Linux 5.11.0-41-generic (Ubuntu 20.04)
- Minecraft 1.18.1
- Fabric Loader version 0.12.12
- Mods
- adorn 3.0.0+1.18.1
- advanced_runtime_resource_pack 0.5.4 via enhancedblockentities
- alternatecurrent 1.1.0
- amecsapi 1.3.3+mc1.18-pre1 via mousewheelie
- appleskin mc1.18-2.2.0
- architectury 3.2.52
- bannerpp 2.0.4+mc.1.18-rc4 via entitybanners
- bitsandchisels 2.6.1
- blue_endless_jankson 1.2.1 via jankson
- blur 2.4.1
- camp_fires_cook_mobs 1.2.3+MC1.18-1.18.1
- cardinal-components 4.0.0
- cardinal-components-base 4.0.1
- cardinal-components-entity 4.0.1
- clickthrough 1.18-fabric0.43.1-0.4
- cloth-basic-math 0.6.0 via cloth-config
- cloth-config 6.1.48
- cloth-config-lite 2.0.6 via petowner
- coat 1.0.0-beta.15 via wandering_collector
- com_moandjiezana_toml_toml4j 0.7.2 via dynamicfps
- companion_bats 1.18.7
- crowdin-translate 1.4+1.18 via camp_fires_cook_mobs
- dark-enchanting 0.6.2+1.18
- dashloader 3.0-rc11-1.18
- dawn 3.1.0
- detailab 2.6.1+1.18-fabric
- dev_quantumfusion_dashloader_dashloader-core 1.1 via dashloader
- dev_quantumfusion_hyphen 0.1 via dashloader
- dynamicfps 2.0.6
- editsign 2.2.7
- enhanced_attack_indicator 1.0.2+1.18
- enhancedblockentities 0.5+1.18
- entitybanners 1.0.2-BETA+1.18
- fabric 0.44.0+1.18
- fabric-api-base 0.4.1+b4f4f6cd14 via sodium
- fabric-api-lookup-api-v1 1.4.0+16d92c47c8 via fabric
- fabric-biome-api-v1 6.0.1+ded849a9c8 via fabric
- fabric-blockrenderlayer-v1 1.1.9+3ac43d95c8 via fabric
- fabric-command-api-v1 1.1.6+3ac43d95c8 via fabric
- fabric-commands-v0 0.2.5+b4f4f6cdc8 via fabric
- fabric-containers-v0 0.1.18+d154e2c6c8 via fabric
- fabric-content-registries-v0 0.4.5+6f53a73dc8 via fabric
- fabric-crash-report-info-v1 0.1.8+3ac43d95c8 via fabric
- fabric-dimensions-v1 2.1.7+43d29571c8 via fabric
- fabric-entity-events-v1 1.4.5+6b21378a14 via bitsandchisels
- fabric-events-interaction-v0 0.4.16+bfa23f17c8 via fabric
- fabric-events-lifecycle-v0 0.2.6+b4f4f6cdc8 via fabric
- fabric-game-rule-api-v1 1.0.10+3ac43d95c8 via fabric
- fabric-item-api-v1 1.3.0+691a79b5c8 via fabric
- fabric-item-groups-v0 0.3.3+3ac43d9514 via bitsandchisels
- fabric-key-binding-api-v1 1.0.8+c8aba2f3c8 via fabric
- fabric-keybindings-v0 0.2.6+b4f4f6cdc8 via fabric
- fabric-language-kotlin 1.7.0+kotlin.1.6.0
- fabric-lifecycle-events-v1 1.4.10+c15ca335c8 via fabric
- fabric-loot-tables-v1 1.0.8+3ac43d95c8 via fabric
- fabric-mining-level-api-v1 1.0.3+3ac43d9514 via bitsandchisels
- fabric-mining-levels-v0 0.1.7+b4f4f6cdc8 via fabric
- fabric-models-v0 0.3.3+3ac43d9514 via bitsandchisels
- fabric-networking-api-v1 1.0.18+3ac43d9514 via wandering_collector
- fabric-networking-v0 0.3.5+b4f4f6cdc8 via fabric
- fabric-object-builder-api-v1 1.11.0+3b82842ec8 via fabric
- fabric-object-builders-v0 0.7.8+3ac43d95c8 via fabric
- fabric-particles-v1 0.2.9+526dc1acc8 via fabric
- fabric-registry-sync-v0 0.8.5+3ac43d9514 via bitsandchisels
- fabric-renderer-api-v1 0.4.9+3ac43d9514 via bitsandchisels
- fabric-renderer-indigo 0.4.12+3ac43d9514 via bitsandchisels
- fabric-renderer-registries-v1 3.2.7+b4f4f6cdc8 via fabric
- fabric-rendering-data-attachment-v1 0.3.4+7242e9d7c8 via fabric
- fabric-rendering-fluids-v1 0.1.18+3ac43d95c8 via fabric
- fabric-rendering-v0 1.1.9+b4f4f6cdc8 via fabric
- fabric-rendering-v1 1.10.3+6b21378a14 via bitsandchisels
- fabric-resource-loader-v0 0.4.11+3ac43d9514 via sodium
- fabric-screen-api-v1 1.0.7+3ac43d95c8 via fabric
- fabric-screen-handler-api-v1 1.1.11+3ac43d95c8 via fabric
- fabric-structure-api-v1 2.0.8+295197a7c8 via fabric
- fabric-tag-extensions-v0 1.2.5+3ac43d9514 via bitsandchisels
- fabric-textures-v0 1.0.9+3ac43d95c8 via fabric
- fabric-tool-attribute-api-v1 1.3.4+7de09f5514 via bitsandchisels
- fabric-transfer-api-v1 1.5.5+b4f4f6cdc8 via fabric
- fabricloader 0.12.12
- fallingleaves 1.8.1+1.18.1
- ferritecore 4.0.0
- fiber 0.23.0-2 via patchouli
- gbfabrictools 1.3.4+1.18 via clickthrough
- indium 1.0.2-alpha1+mc1.18
- io_airlift_aircompressor 0.21 via dashloader
- jankson 4.0.0+j1.2.0 via adorn
- java 17
- kanos_config 0.1.4+1.14.4-1.17.1 via pehkui
- lambdynlights 2.1.0+1.17
- libcd 3.0.3+1.16.3 via adorn
- libgui 5.1.0+1.18 via adorn
- libninepatch 1.1.0 via libgui
- lightoverlay 6.0.4
- lithium 0.7.6
- midnightlib 0.3.1 via rocks
- minecraft 1.18.1
- modmanager 1.2.1+1.18
- modmenu 3.0.1
- mousewheelie 1.8.0+mc1.18-pre5
- notenoughcrashes 4.1.3+1.18
- omega-config 1.0.8 via dark-enchanting
- org_aperlambda_lambdajcommon 1.8.1 via spruceui
- org_jetbrains_kotlin_kotlin-reflect 1.6.0 via fabric-language-kotlin
- org_jetbrains_kotlin_kotlin-stdlib 1.6.0 via fabric-language-kotlin
- org_jetbrains_kotlin_kotlin-stdlib-jdk7 1.6.0 via fabric-language-kotlin
- org_jetbrains_kotlin_kotlin-stdlib-jdk8 1.6.0 via fabric-language-kotlin
- org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm 1.5.2 via fabric-language-kotlin
- org_jetbrains_kotlinx_kotlinx-coroutines-jdk8 1.5.2 via fabric-language-kotlin
- org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm 1.3.1 via fabric-language-kotlin
- org_jetbrains_kotlinx_kotlinx-serialization-core-jvm 1.3.1 via fabric-language-kotlin
- org_jetbrains_kotlinx_kotlinx-serialization-json-jvm 1.3.1 via fabric-language-kotlin
- org_joml_joml 1.10.2 via sodium
- owo 0.3.8+1.18
- patchouli 1.18.1-61-FABRIC
- pehkui 3.0.0+1.14.4-1.18
- petowner 1.8.2-1.18-pre4+
- pipette 1.0.1
- pride 1.1.0+1.17 via lambdynlights
- promenade 2.2.0
- reborncore 5.1.0-beta.4 via techreborn
- reeses-sodium-options 1.2.3
- rocks 1.5.2
- satin 1.7.0 via blur
- sodium 0.4.0-alpha5+build.9
- sodium-extra 0.3.7
- sound_track 1.0.6
- spruceui 3.3.0+1.17 via lambdynlights
- stacc 1.2.3 via bitsandchisels
- static-content 1.0.1-1.16.2 via companion_bats
- staticdata 1.1.2 via static-content
- taxfreelevels 1.3
- team_reborn_energy 2.0.0-beta1 via techreborn
- techreborn 5.1.0-beta.4
- terraform-shapes-api-v1 2.1.0 via dawn
- terrarianslimes 1.1-BETA+1.18
- tweed4_annotated 1.2.0 via wandering_collector
- tweed4_base 1.3.1 via wandering_collector
- tweed4_data 1.2.0 via wandering_collector
- tweed4_data_hjson 1.1.0 via wandering_collector
- tweed4_tailor_coat 1.0.2 via wandering_collector
- tweed4_tailor_screen 1.0.2 via wandering_collector
- victus 0.1.4+1.18
- visualoverhaul 4.0.0
- wandering_collector 1.0.3+mc1.18-rc3
- waterdripsound 1.18-0.3.0
- witherturnsskeletons 1.1.0-1.18.0
- wthit 4.4.0
- Version 2.1.0+1.17
- Branch 1.17
Additional context
You must have a 144 Hz or higher monitor to test this!
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.
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.
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.
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
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.
Lantern + "Always Defer Chunk Updates"
The frametimes here are better, but visually I can see that the lighting updates themselves are not every frame.
Moving onto the "Limitless" version
Lantern
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"
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.