-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Sodium 0.5 incompatibility #178
Conversation
src/main/java/dev/lambdaurora/lambdynlights/LambDynLightsCompat.java
Outdated
Show resolved
Hide resolved
i accidentally hit commit & push before realizing a better idea- |
Decided to give it a play-test on my radeon dGPU + iGPU and i cannot seem to reproduce the flickering chunks, is it intel-related? |
I don't use Intel, the flickering chunks were on my Radeon Vega 8. Though this was in debugging mode in a development environment, so that might also change things. |
Possibly although i will attempt to run a second play-test using an Intel iGPU instead to see what comes out. |
Did the play-test and i still can't note flickerings from moving around with an torch although there are minor delays in certain places although hard to spot. |
As an avid fan & user of the mod, thank you for making a PR! I tested this myself (AMD Ryzen cpu + Nvidia gpu) and didn't observe any flickering. Dynamic lights don't seem as "fluid" as before when the subject is moving, giving a subtle stuttering effect. This was mostly observed with flame arrows but is noticeable for common scenarios like the player holding a torch. |
Can confirm. No flickering but the lighting is not that fluid anymore. |
There is flickering, rtx 3050 ti |
Please run |
src/main/java/dev/lambdaurora/lambdynlights/mixin/sodium/LightDataAccessMixin.java
Outdated
Show resolved
Hide resolved
done |
yeah I'm getting delayed lighting as well. Also the lighting looks different? Idk. |
currently using your build of LambDynamicLights and it does seem to work with Sodium 0.5, however the only issue I've found atm is that it's not as fluid as it should be. No flickering though, and I'm on an iGPU 6000. |
seems a very common factor is the update fluidity. making a RETURN injection into ArrayLightDataCache and/or HashLightDataCache's |
I'm unable to properly verify if this commit will improve light update fluidity, can someone help verify? An outstanding problem that I am noticing with light update fluidity is that the sub-chunk (16x16x16) below you will update slower compared to your current sub-chunk, this appears to be a little quirk with Sodium 0.5 though. I'm not sure how that can be dealt with. |
gonna try it in a few hours gimme a lil bit |
lighting still feels a little delayed but is better I think. The light still looks weird though. |
I have tested this PR, and I am noticing significant delays in light propagation, and the light pattern is also very strange. |
I realized that the light delay issue is actually a precision issue. I think what we can do is either:
Method 1 is hacky way and easily break with something like this: int word1 = cache.get(x1, y1, z1);
int word2 = cache.get(x2, y2, z2);
int lm1 = getLightmap(word1);
int lm2 = getLightmap(word2); Method 2 is more safer way, but it would be a complete mess. Both methods are pretty bad, so it might be better to send PR to Sodium to address this. |
i don't really understand how all of this work but I have the impression it's a sync issue, it's more visible when turn off smooth lightning : 2023-08-29.00-09-13_H.264.mp4 |
I suspect the weird lighting is because luminance is not being updated. The original lightmap MUKSC referenced above was updating both the block light and luminance. I pushed a pull request to BluSpring a couple of days ago since my git is rusty and I didn't want to clutter things with a failed attempt. Which I did fail and just fixed thanks to UnablePath noticing my failed push attempt. I have a branch with an updated lighting that utilizes Sodium's system a bit further. I can't seem to post a test release properly because I haven't remembered how to add a tag properly yet, but the code compiles and looks a lot smoother on my end. If anyone who is able to compile can test that would be great as I'd love to see this fixed on the latest version. |
In my previous commit, I had just noticed something particularly interesting: The flat lighting data did not match the data without Sodium. In @donington's branch, I had noticed these things on my end:
In my latest commit, I decided to try reading further in understanding how Sodium handled lighting in both pipelines, and realized something: It still uses There is however one final problem: The smooth lighting data still generates some weird patterns, and I'm currently unsure as to what is causing it. However, from what I can tell, the light updating seems to be much smoother now, at least on my side. |
Now that I'm seeing the top-down view of the weird light pattern, it's genuinely fun to see? I think at this point it's not bothering me as much if the delay issue is fixed. Could you please undo the copyright header changes for previously existing files? The dates are supposed to be the dates of the creation of the file, and the gradle plugin seems to have gotten confused and not recognized the files. |
Done. When I ran the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this PR has reached a good enough stage for me to merge it in in a couple of hours.
I might rework a little bit some details to loosen up the requirement to have Sodium 0.5 for compilation to work through the power of aggressive Mixin Pseudo.
Otherwise, congratulations on the PR and huge thanks to everyone who contributed to it, I don't think I would have had the courage to figure out this solution!
Nice! |
Drive-by comment, as I am not familiar with the LDL code, but if it previously assumed it could use all 8 bits of the lightmap coordinates, that is no longer the case in Sodium 0.5 - you can only use the top 4. Providing something like |
LDL does in fact use all 8 bits, and the bottom 4 being unusable was what I had assumed, and that does appear to be the case with the smooth lighting pipeline, hence why I switched to just directly modifying the lightmap value returns, but what I do find interesting is that the flat lighting pipeline doesn't appear to really abide by this rule, aside from the very edge of the light area. |
Issue: #175
In Sodium 0.5, they appear to have moved from Vanilla's LightmapTextureManager to using LightDataAccess. However, this brings in the caveat of not using Vanilla's
WorldRenderer#getLightmapCoordinates
, which LambDynLights relies on to provide dynamic light data to the renderer.This PR creates a mixin into LightDataAccess that passes the dynamic light data onto Sodium. This unfortunately looks like the only way to both provide this lighting data and make it limited to the renderer alone. An injection into
BlockRenderView#getLightLevel
may also be plausible to provide that light data, but it would disrupt the world's light data for both Vanilla and mods.WARNING: I observed large amounts of chunk flickering on my integrated GPU after making this change, so I suspect that more work will have to be done for this change to actually be viable.