LambdAurora / LambDynamicLights

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

Shape of light does not match vanilla #43

Closed FewerFlaws closed 3 years ago

FewerFlaws commented 3 years ago

Is your feature request related to a problem? Please describe. If I am standing on a torch then pick it up I can see the lit region around me shrink rather suddenly. This, it seems, is because Dynamic Lights creates light in a radius around you whereas vanilla light creates square patterns.

Describe the solution you'd like Increase the radius of held lights so that the area of the lit circle is the same as the area of the lit square provided by the item when placed. The circular light pattern is a lot more nice to look at. The square pattern of vanilla light sources is fine since they don't move, but it would be weird when carrying a torch to see that the light extends further in cardinal directions.

Describe alternatives you've considered

Additional context I use True Darkness, which makes the effect easy to see.

Screenshot 1: There is a torch on the ground and I am standing slightly in front of it. Notice the gold and iron bars. 2020-12-31_05 35 35

Screenshot 2: I've remove the torch on the ground but continue to hold one in my hand. Only the iron bar in the center is still visible. 2020-12-31_05 35 46

Screenshot 3: Just looking straight down so you can see that I was standing basically on top of the torch, but slightly ahead of it. 2020-12-31_05 35 50

LambdAurora commented 3 years ago

There's 2 reasons for the current dynamic lighting radius:

  1. Higher radius would rebuild more chunks which significantly slows down the game a lot. Sodium optimizes that, and once I can use Canvas' dynamic lighting feature with Canvas it'll be fast too, but Vanilla will still struggle a lot.
    1. It kind of also serves as a balance/gameplay measure, it's a bit too cheaty in my opinion to have a the same light radius without ever placing actual light sources. But I can understand why some people would want it though.

So I might implement a slider for the radius, but not sure when I'll do that.

And for the fade-in/fade-out effect it would require more work and updates than I'm comfortable with so the chances of it ever made it into the mod is slim.

FewerFlaws commented 3 years ago

I prefer not to have a slider because it becomes too easy to crank things up.  But it makes sense for torches in your hand to be just as effective as torches that are placed. Right now they are noticeably less effective.

Vanilla torches provide a light level of 14 blocks, meaning that the lighted region extends 14 blocks out in the cardinal directions.  A total of 365 blocks are lit by a torch.  To light the same number of blocks using a circular pattern, the necessary radius is sqrt(365/pi) blocks long, or 10.779 blocks.  Here's a small chart generalizing this for light levels up to 25 (note that light levels of 15 are the maximum possible with vanilla objects):

Capture

FewerFlaws commented 3 years ago

This is balanced. I'm not sure how the code works, but it seems like this change would not increase the load significantly. Perhaps I'm mistaken =]

LambdAurora commented 3 years ago

A dynamic light source lit up a maximum of 8 chunk sections with a radius of 7.75, if going higher than 7.75 it will go beyond those 8 chunk sections and will cause even more performance issues.

The issue with chunk rebuilds is it recomputes the geometry of a chunk and re-send the whole chunk to the GPU. The more complex the chunk is the more slow it gets (#16).

If I had another way of doing dynamic lighting with maybe a shader pipeline I would be more comfortable with this change.

FewerFlaws commented 3 years ago

Ah, I gotcha. You've found the sweet spot and the tradeoff isn't worth it to go bigger. I'm more prone to notice the difference than most people, and it's a small discrepancy in the first place. You're probably in the right here. Cheers ^_^

On Fri, Jan 1, 2021 at 1:00 AM LambdAurora notifications@github.com wrote:

A dynamic light source lit up a maximum of 8 chunk sections with a radius of 7.75, if going higher than 7.75 it will go beyond those 8 chunk sections and will cause even more performance issues.

The issue with chunk rebuilds is it recomputes the geometry of a chunk and re-send the whole chunk to the GPU. The more complex the chunk is the more slow it gets (#16 https://github.com/LambdAurora/LambDynamicLights/issues/16).

If I had another way of doing dynamic lighting with maybe a shader pipeline I would be more comfortable with this change.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LambdAurora/LambDynamicLights/issues/43#issuecomment-753288959, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBDWM5SC57NXLLUU5ROI6LSXWFLHANCNFSM4VPNVA7A .

LambdAurora commented 3 years ago

Though, latest Canvas builds have built-in hand-held lighting (but not more yet and the way it's done don't allow me to add proper compatibility yet) but might match better the vanilla pattern? At least there's not the radius issue with performances (and it has colored lighting which is sweet).

FewerFlaws commented 3 years ago

I've been eyeing up that canvas renderer. Sodium causes flickering on iron bars with its compax vertex formats so I have them disabled. I'm not sure how much performance I'm getting at this point. But performance is my priority; smooth framerates trump texture quality any day. I had no idea about the built in hand-held lighting there. Thanks for the tip =D