Skip to content

Add dynamic lighting with Fast/Fancy quality toggle#1330

Closed
MCbabel wants to merge 2 commits intosmartcmd:mainfrom
MCbabel:dynamic-lighting
Closed

Add dynamic lighting with Fast/Fancy quality toggle#1330
MCbabel wants to merge 2 commits intosmartcmd:mainfrom
MCbabel:dynamic-lighting

Conversation

@MCbabel
Copy link
Contributor

@MCbabel MCbabel commented Mar 18, 2026

Description

This adds dynamic lighting to the game, similar to how OptiFine handles it in Java Edition. A lot of people on the discord server have been asking for this so I went ahead and implemented it. It's off by default and can be toggled on in the graphics settings menu.

There's two modes: Fast (cheaper, only player held items glow, smaller radius) and Fancy (full entity lighting including dropped items, blazes, burning mobs etc).

Gameplay footage

https://youtu.be/0wDQjRi5HqM

Changes

Previous Behavior

No dynamic lighting existed. Holding a torch in your hand didn't illuminate the area around you. Only placed light sources (torches, glowstone blocks etc) emitted light.

Root Cause

The original LCE codebase never had dynamic lighting - it wasn't part of TU19. OptiFine added this to Java Edition as a popular mod feature but it never made it into the console versions.

New Behavior

Players holding light-emitting items (torches, glowstone, lava buckets etc) now light up the surrounding area in real-time. In Fancy mode, dropped items and certain entities also emit light. The setting persists between sessions.

Fix Implementation

  • Added getDynamicLight() and updateDynamicLights() to Level which collects light sources from players/entities each tick and provides additional brightness to the rendering pipeline via Region::getLightColor() and Level::getLightColor()
  • Added Item::getItemLightLevel() to query light emission for held/dropped items
  • Thread-safe using CRITICAL_SECTION since chunk rebuilds happen on separate threads
  • Two quality modes controlled via a slider in graphics settings:
    • Fast: Manhattan distance, players only, radius capped at 6
    • Fancy: Euclidean distance, all entities, radius capped at 10
  • Patched all resolution variants of the graphics menu SWF (1080, 720, 480, Split1080, Split720) to include the new checkbox and slider
  • Settings stored in the existing uiBitmaskValues bitmask (bits 24-25) so they persist in settings.dat
  • Purely visual, does not affect mob spawning or any gameplay mechanics

Related Issues

  • N/A (feature request from discord community)

@MCbabel MCbabel marked this pull request as draft March 18, 2026 03:57
@MCbabel MCbabel marked this pull request as ready for review March 18, 2026 04:00
@mattsumi
Copy link
Collaborator

This PR is REJECTED and will be closed because:

Heavy AI usage.
This user has been blacklisted from contributing.

Look at our CONTRIBUTING.md for more info.

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 18, 2026

@mattsumi “vibe coded”? Well, I'd really appreciate a more specific reason other than just that my changes are “vibe coded.”

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 19, 2026

@mattsumi To be honest, I think it's pretty ridiculous and disrespectful to label my changes as “vibe coded” and then not give me a specific reason why my code is supposed to be “vibe coded” now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants