SchmarrnDevs / Lighty

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

Loss of Rendering Precision at Large Coordinates #81

Open kreivon opened 6 days ago

kreivon commented 6 days 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 5 days 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!