SchmarrnDevs / Lighty

The Light Overlay Mod with a twist!
https://modrinth.com/mod/lighty
Apache License 2.0
18 stars 13 forks source link

Loss of Rendering Precision at Large Coordinates #81

Closed kreivon closed 1 month ago

kreivon commented 1 month ago

Light overlay will lose precision and become distorted the further away from the world origin the player travels. This ranges from the overlay flickering as the camera pans (100k) to complete distortion as shown in the attached image (10mil).

This is especially impactful for players on PVP servers where building bases in the millions is a requirement to stay secure.

Steps to Reproduce: Tested on Fabric 1.21.1

  1. Enable overlay
  2. Teleport to X:1_000_000 or another coordinate far from the world origin
  3. Overlay will be noticeably distorted

2024-10-21_18 03 35

Possible Solution: I believe this can be solved by translating the matrices so that the render origin is offset by subtracting the camera position. The loss of precision caused by large coordinates could be eliminated by such an offset.

andi-makes commented 1 month ago

Thank you for this detailed issue! It is great to have all the relevant information from the start :)

I'll try to fix this issue within the next week or so, I'll keep you updated here!

andi-makes commented 1 month ago

This got fixed in Lighty v3.0.0-beta.5 for Minecraft 1.21.3. I don't know if I have time to do a release for 1.21.1 though, so if you need the fix on 1.21.1, let me know here and I'll look into it on the next weekend.