Skip to content

Shade under-island engines so they read as in shadow#24

Merged
jasonkneen merged 2 commits into
mainfrom
claude/adoring-hawking-P6d08
Jun 5, 2026
Merged

Shade under-island engines so they read as in shadow#24
jasonkneen merged 2 commits into
mainfrom
claude/adoring-hawking-P6d08

Conversation

@jasonkneen

@jasonkneen jasonkneen commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Problem

The lift/turbo propeller engines and the heavy rocket engine hang in the island's shadow, but their MeshLambertMaterials still caught full ambient + sky light. The result: the under-island hardware reads far too bright — freshly-minted rather than weathered and in-shadow — against the dark underside (see attached screenshot).

Fix

A "used-universe" shade that fakes the ambient occlusion the island above would cast:

  • engine/world/09b-voxel-build-factories.js — new tunable UNDER_ISLAND_ENGINE_SHADE (~0.6×) plus shadeEngineHex / engineBuildMaterial helpers. The lift engine's 8-colour palette now routes through engineBuildMaterial, so every voxel is darkened toward black. Darkened colours cache under their own key, so engines still merge by material (no perf regression).
  • engine/world/03-geometry-materials.js — the rocket-only rocketSteel / rocketSteelD materials are darkened ~0.6× to match. The glowing nozzle (rocketHeat) is intentionally left intact.

Tune the look by adjusting the single UNDER_ISLAND_ENGINE_SHADE constant (1 = untouched, lower = darker).

Verification

  • npm run check ✅ (i18n + duplicate-declaration scan)
  • npm run smoke

https://claude.ai/code/session_01SYYysXAcC88KuMgvhb2noh


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Rocket components no longer appear overly bright when rendered beneath the island
    • Lift engine materials now display proper shading in under-island areas
    • Decorative dressing elements now render with correct shadow shading throughout the island structure

The lift/turbo propeller engines and the heavy rocket engine hang in the
island's shadow, but their Lambert materials still caught full ambient +
sky light, so they read far too bright (freshly-minted) against the dark
underside.

Add a tunable UNDER_ISLAND_ENGINE_SHADE (~0.6x) that multiplies the lift
engine palette toward black via a new engineBuildMaterial helper, and
darken the rocket-only steel materials to match. Gives the under-island
hardware a used/aged, properly-occluded look. The glowing rocket nozzle
(rocketHeat) is left intact.
@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy Preview for tiny-world-builder ready!

Name Link
🔨 Latest commit 4008487
🔍 Latest deploy log https://app.netlify.com/projects/tiny-world-builder/deploys/6a22a3639855ad00084d5b57
😎 Deploy Preview https://deploy-preview-24--tiny-world-builder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9b2ec26c-3c5b-4a28-a6ff-af29e1ba4cd8

📥 Commits

Reviewing files that changed from the base of the PR and between ef2ad86 and 4008487.

📒 Files selected for processing (3)
  • engine/world/03-geometry-materials.js
  • engine/world/09b-voxel-build-factories.js
  • engine/world/13-distant-dressing-ghost.js

📝 Walkthrough

Walkthrough

This PR implements a comprehensive under-island material shading system by introducing a reusable shadeLambertMaterial() helper utility, applying pre-darkened hex colors to engine components, and darkening dressing materials through mesh traversal. Three files coordinate to ensure materials rendering beneath the island appear correctly shaded rather than over-bright.

Changes

Under-Island Material Shading

Layer / File(s) Summary
Shading utility and rocket material darkening
engine/world/03-geometry-materials.js
shadeLambertMaterial(mat, factor) helper clones and scales Lambert material colors (base and emissive) by factor, memoizes clones by UUID and factor in shadedMaterialCache, and returns unchanged when factor is 1 or input is invalid. M.rocketSteel and M.rocketSteelD are darkened to match under-island rendering.
Engine material darkening and lift-engine integration
engine/world/09b-voxel-build-factories.js
shadeEngineHex(hex, factor) darkens hex colors before material construction. engineBuildMaterial(hex, textureKind) wraps voxelBuildMaterial with pre-darkened input. makeVoxelLiftEngine switches all component materials (stone, steel, wood, label, noise) from voxelBuildMaterial to engineBuildMaterial.
Dressing material shading via traversal and application
engine/world/13-distant-dressing-ghost.js
UNDER_ISLAND_DRESSING_SHADE constant defines dressing shade factor. Island edge dressing generation wraps materials with shadeLambertMaterial. addIslandUtilityUnderside builds underside geometry into a detached group, traverses all meshes, replaces each material with shaded variant, then attaches to destination.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Beneath the island, shadows dance,
Where rockets and decor enhance,
We shade each Lambert, factor-true,
So under-island renders blue!
Cached and cloned, each hue takes flight,
Making island depths just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: darkening under-island engines so they appear shaded. It matches the core objective of making hanging engines render correctly in shadow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/adoring-hawking-P6d08

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 and usage tips.

Engines were still too bright: drop UNDER_ISLAND_ENGINE_SHADE 0.6 -> 0.45
(and the rocket-only steel materials to match).

Also shade the other hardware that floats beneath the island. Add a
cached shadeLambertMaterial() helper and a UNDER_ISLAND_DRESSING_SHADE,
then darken the utility underside (pipes/trays/boxes/clamps/cables) and
the hanging edge-dressing cubes so they read as occluded rather than
sunlit. The utility underside is built into a detached group and shaded
in one pass; static-mesh merging still works (it traverses recursively
and bakes world transforms). The sunlit grass lip and shared top-surface
materials are left untouched.
@jasonkneen jasonkneen marked this pull request as ready for review June 5, 2026 12:45
Copilot AI review requested due to automatic review settings June 5, 2026 12:45
@jasonkneen jasonkneen merged commit 45e86a7 into main Jun 5, 2026
5 of 6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR darkens under-island hardware (engines + hanging “dressing” like pipes/trays/boxes) so it reads as being in the island’s shadow, addressing overly-bright Lambert materials under the island.

Changes:

  • Added a tunable under-island engine shade factor and routed lift-engine palette materials through a shaded material factory.
  • Darkened rocket-engine steel materials to visually match the under-island engine shading.
  • Added a cached shadeLambertMaterial helper and applied it to under-island dressing (edge drops + utility underside group).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
engine/world/13-distant-dressing-ghost.js Applies a constant shade factor to under-island dressing materials (edge drops + utility underside group).
engine/world/09b-voxel-build-factories.js Introduces under-island engine shade constant + helpers, and routes lift-engine palette materials through the shaded pipeline.
engine/world/03-geometry-materials.js Adds cached shadeLambertMaterial helper and darkens rocket steel materials to match under-island shading.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// every engine palette colour toward black to fake the ambient occlusion the
// geometry above would cast — a "used-universe" shaded look. 1 = untouched,
// lower = darker. Tune here to taste.
const UNDER_ISLAND_ENGINE_SHADE = 0.45;
Comment on lines +272 to +276
// Darkened (~0.45x) so the heavy/rocket engine reads as shaded under the
// island instead of brightly lit — parity with the lift engine's under-island
// shade (engine/world/09b UNDER_ISLAND_ENGINE_SHADE). Rocket-only materials.
rocketSteel: new THREE.MeshLambertMaterial({ color: 0x35383c, side: THREE.FrontSide }),
rocketSteelD: new THREE.MeshLambertMaterial({ color: 0x15181b, side: THREE.FrontSide }),
@jasonkneen jasonkneen deleted the claude/adoring-hawking-P6d08 branch June 9, 2026 23:15
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.

3 participants