Skip to content

feat(sky): dim/brighten the moon highlight through its phase - #86

Open
soloturn wants to merge 1 commit into
developfrom
soloturn-moon-phases
Open

feat(sky): dim/brighten the moon highlight through its phase#86
soloturn wants to merge 1 commit into
developfrom
soloturn-moon-phases

Conversation

@soloturn

@soloturn soloturn commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Companion to a MovingBlocks/Terasology engine PR adding CelestialSystem/BackdropProvider#getMoonPhase() for MovingBlocks/Terasology#94 - a hook for basing the moon's phase on the game's day counter.

What changed

sky_frag.glsl's moon highlight (the soft glow rendered opposite the sun once it's below the horizon - there's no separate textured moon disc) previously used a hardcoded MOON_HIGHLIGHT_INTENSITY_FACTOR of 1.0, so it was always full brightness regardless of what phase the moon should be in. Replaced that #define with a moonPhaseIntensity uniform, set in BackdropNode from 1.0 - abs(backdropProvider.getMoonPhase() * 2.0 - 1.0) - a triangle wave that's 0 at new moon (phase 0 or 1) and 1 at full moon (phase 0.5), folding smoothly between. No new textures or art assets needed - this reuses the existing highlight rendering, just no longer holds its peak brightness constant.

⚠️ Please verify live before merging

Compiles against a local engine checkout carrying the paired getMoonPhase() addition. No GL context available here to render and confirm visually - the shader/uniform change is small and mirrors the existing sunExponent/skySettings wiring pattern already used a few lines above it in BackdropNode, but this genuinely needs an eyeball check in-game across a few in-game days to confirm the fade reads correctly (e.g. via the sun-halting debug command to fast-check specific phases).

Companion PR: MovingBlocks/Terasology#5387

Companion to a MovingBlocks/Terasology engine PR adding
CelestialSystem/BackdropProvider#getMoonPhase() for MovingBlocks/
Terasology#94 - a hook for basing the moon's phase on the game's day
counter.

sky_frag.glsl's moon highlight (the soft glow rendered opposite the
sun once it's below the horizon - there's no separate textured moon
disc) previously used a hardcoded MOON_HIGHLIGHT_INTENSITY_FACTOR of
1.0, so it was always full brightness regardless of what phase the
moon should be in. Replaced that #define with a moonPhaseIntensity
uniform, set in BackdropNode from
1.0 - abs(backdropProvider.getMoonPhase() * 2.0 - 1.0) - a triangle
wave that's 0 at new moon (phase 0 or 1) and 1 at full moon (phase
0.5), folding smoothly between. No new textures or art assets
needed - this reuses the existing highlight rendering, just no longer
holds its peak brightness constant.

## Verification

Compiles against a local engine checkout carrying the paired
getMoonPhase() addition (symlinked in for the build, not committed
here). No GL context available to render and confirm visually - the
shader/uniform change is small and mirrors the existing sunExponent/
skySettings wiring pattern already used a few lines above it in
BackdropNode, but this genuinely needs an eyeball check in-game
across a few in-game days to confirm the fade reads correctly.

Companion PR: MovingBlocks/Terasology#TBD

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f98006fe-456b-4ca0-bf3b-0471f9c56e43


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant