Graphics & performance pass: presets, perf overlay, water, debug tooling#3
Conversation
…bug tooling - Graphics settings: Low/Medium/High presets + individual toggles (render scale, shadows, water, foliage, clouds, FXAA), persisted to localStorage, low-end autodetect, reactive apply without reload - Perf overlay (F3): FPS, frame ms, draw/tris, loaded/meshed/visible/culled chunks, shadow casters, water meshes, lighting/fog/water values - Render scale (hardware scaling) + optional FXAA (pure FXAA, no image-processing washout), adaptive chunk gen/mesh/light budgets from frame time - Frozen world matrices on static chunk meshes; foliage render-distance cull - Cloud quality tiers (off/simple/fancy) with day/night dimming - Shadow quality tiers (off/low/med/high) via runtime reconfigure - Water: StandardMaterial blue tint with emissive floor + specular glint, scene fog + lights; vertex colours stripped so lakes render continuously (no chunk seams); debug opacity/off toggles - Fog tuned per preset; face shading deepened for terrain depth - Debug tooling: wireframe (N), chunk borders (B), water/shadow/fog/post toggles, safe-mode terrain isolation, material dump, water audit, lifecycle logging - WebGL context-loss handling, render-distance cap, clean disposal
📋 SummaryNo linked issues found in the PR description. This PR introduces a graphics/performance foundation for the Babylon.js voxel game: three graphics presets (Low/Medium/High), a runtime graphics controller, an F3 performance overlay, scalable water/cloud/shadow/foliage tiers, debug console helpers, and adaptive chunk streaming budgets. It also fixes water visibility and chunk-seam issues by switching water to a uniform-tint All verification commands pass: 📌 Review Metadata
🔴 Critical Issues (Must Fix - Blocks Merge)None identified.
|
| Principle | Score | Notes |
|---|---|---|
| Single Responsibility | 7 | GraphicsController cleanly separates settings data from engine application; Game.ts accumulates many debug hooks but they are isolated behind _ methods. |
| Open/Closed | 6 | New quality tiers are added via switch statements; extending them requires editing multiple files. |
| Liskov Substitution | 8 | No inheritance hierarchies introduced; new materials conform to existing usage patterns. |
| Interface Segregation | 7 | WaterMaterial exposes unused setDayNight/setFog/setTime no-ops purely for compatibility. |
| Dependency Inversion | 7 | Settings are plain data; controller depends on Babylon types, but world/scene coupling is already established. |
| Average | 7.0 |
🎯 Final Assessment
Overall Confidence Score: 78%
Confidence Breakdown:
- Code Quality: 80% (clean, well-commented, typechecks and builds; some stale comments and unused helpers)
- Completeness: 75% (presets are missing the advertised render-distance nudge; otherwise feature-complete per PR description)
- Risk Level: 70% (low-risk additive changes, but debug-only water audit uses a magic number)
- Test Coverage: 40% (manual-test checklist recommended; no automated tests added)
Merge Readiness:
- All critical issues resolved
- SOLID average score >= 6.0
- Overall confidence >= 60%
- No security concerns
- Builds and typechecks passing
Verdict:
MERGE WITH FIXES — Presets should wire up presetRenderDistance and WATER_BLOCK should replace the magic number before merging; remaining items are documentation/cleanup.
…tale comments Medium: - applyGraphicsPreset now also sets the preset's recommended render distance (was documented but not implemented); import presetRenderDistance - waterStats() uses the exported WATER_BLOCK constant instead of a hardcoded 7 - ChunkBorderOverlay: preallocate a position pool + static line-list index on a single updatable LinesMesh; rebuilds now overwrite the pool + refresh the SubMesh range instead of allocating thousands of Vector3s and disposing/ recreating the mesh each chunk-boundary crossing Low: - Update stale back-face-culling comments (culling is OFF; winding mismatch); fix doubleSided default to true so omitted = safe - Update ChunkMesher comments to match the four-channel colour baking and the water pass discarding colours - Update LightingSystem comment: water uniforms are no-ops (StandardMaterial uses scene lights/fog) - Remove redundant cutout receiveShadows reassignment - Rename Clouds.addQuad corner params to avoid shadowing outer cz - Remove dead Sky.setCloudsEnabled
📋 SummaryNo linked issues found in the PR description. This PR adds a browser-friendly graphics/performance layer: three scalable presets, an F3 performance overlay, adaptive chunk streaming budgets, a new 📌 Review Metadata
🔴 Critical Issues (Must Fix - Blocks Merge)None identified.
|
| Principle | Score | Notes |
|---|---|---|
| Single Responsibility | 7 | GraphicsController cleanly separates settings data from engine application; Game.ts accumulates debug hooks but they are isolated behind _ methods. |
| Open/Closed | 6 | New quality tiers are added via switch statements; extending them requires editing multiple files. |
| Liskov Substitution | 8 | No inheritance hierarchies introduced; new materials conform to existing usage patterns. |
| Interface Segregation | 7 | WaterMaterial exposes unused setDayNight/setFog/setTime no-ops purely for compatibility. |
| Dependency Inversion | 7 | Settings are plain data; controller depends on Babylon types, but world/scene coupling is already established. |
| Average | 7.0 |
🎯 Final Assessment
Overall Confidence Score: 78%
Confidence Breakdown:
- Code Quality: 85% (clean, well-commented, typechecks and builds; a few debug-helper inconsistencies and an undersized debug buffer)
- Completeness: 80% (feature-complete per PR description; debug shadow toggle and chunk-border pool need finishing)
- Risk Level: 75% (large additive PR with low game-logic risk; shadow generator rebuild and debug toggles are the main operational concerns)
- Test Coverage: 40% (manual-test checklist recommended; no automated tests added)
Merge Readiness:
- All critical issues resolved
- SOLID average score >= 6.0
- Overall confidence >= 60%
- No security concerns
- Builds and typechecks passing
Verdict:
MERGE WITH FIXES — Increase the chunk-border vertex pool to account for the viewDistance + 2 unload margin, route __voxl.shadows() through applySettings, and make ShadowManager.configure() skip rebuilding when the config is unchanged.
Medium: - ChunkBorderOverlay: size the vertex pool for the unload radius (viewDistance + 2), not the view-distance square, so borders draw for every loaded chunk at the max slider value - __voxl.shadows() now routes through applySettings so the shadow tier, UI, and localStorage stay in sync (was calling shadows.setEnabled directly) - ShadowManager.configure() skips the teardown/rebuild when the resolved config matches the live generator's config (tracks appliedConfig); avoids needless generator rebuilds when unrelated graphics settings (e.g. render scale) change Low: - Remove unused elapsed accumulator + LightingSystem.setTime call + the no-op WaterMaterial.setTime (water animation not implemented) - applySettings copies the patch before clamping viewDistance so the caller's object is never mutated
📋 SummaryNo linked issues found in the PR description. This PR adds a browser-friendly graphics/performance layer to the Babylon.js voxel game: three scalable presets, an F3 performance overlay, adaptive chunk streaming budgets, a 📌 Review Metadata
🔴 Critical Issues (Must Fix - Blocks Merge)None identified.
|
| Principle | Score | Notes |
|---|---|---|
| Single Responsibility | 7 | GraphicsController cleanly separates settings data from engine application; Game.ts accumulates debug hooks but they are isolated behind _ methods. |
| Open/Closed | 6 | New quality tiers are added via switch statements; extending them requires editing multiple files. |
| Liskov Substitution | 8 | No inheritance hierarchies introduced; new materials conform to existing usage patterns. |
| Interface Segregation | 7 | WaterMaterial exposes unused setDayNight/setFog no-ops purely for API compatibility. |
| Dependency Inversion | 7 | Settings are plain data; controller depends on Babylon types, but world/scene coupling is already established. |
| Average | 7.0 |
🎯 Final Assessment
Overall Confidence Score: 82%
Confidence Breakdown:
- Code Quality: 85% (clean, well-commented, typechecks and builds; minor hot-path inefficiencies)
- Completeness: 85% (feature-complete per PR description; presets, water fix, debug tooling all wired)
- Risk Level: 80% (large additive PR but low game-logic risk; main concern is a small hot-path perf regression)
- Test Coverage: 40% (manual-test checklist recommended; no automated tests added)
Merge Readiness:
- All critical issues resolved
- SOLID average score >= 6.0
- Overall confidence >= 60%
- No security concerns
- Builds and typechecks passing
Verdict:
MERGE WITH FIXES — Remove the per-frame string-key parsing from the foliage cull (and forEachOpaqueMesh) before merging; the remaining items are minor cleanups.
Medium: - Cache numeric cx/cz on ChunkMeshes (set once in applyMesh) so the foliage distance-cull and forEachOpaqueMesh hot loops read coords directly instead of parsing the map key (indexOf + parseInt) for every chunk every frame Low: - Clouds.bindFog reuses a scratch Vector2 instead of allocating one per frame - Align dprCap migration clamp with its documented range (1.5..2, was 1..3)
📋 SummaryNo linked issues found in the PR description. This PR adds a browser-friendly graphics/performance layer to the Babylon.js voxel game: three scalable presets, an F3 performance overlay, adaptive chunk streaming budgets, a 📌 Review Metadata
🔴 Critical Issues (Must Fix - Blocks Merge)None identified.
|
| Principle | Score | Notes |
|---|---|---|
| Single Responsibility | 7 | GraphicsController cleanly separates settings data from engine application; Game.ts accumulates debug hooks but they are isolated behind _ methods. |
| Open/Closed | 6 | New quality tiers are added via switch statements; extending them requires editing multiple files. |
| Liskov Substitution | 8 | No inheritance hierarchies introduced; new materials conform to existing usage patterns. |
| Interface Segregation | 7 | WaterMaterial exposes unused setDayNight/setFog no-ops purely for API compatibility. |
| Dependency Inversion | 7 | Settings are plain data; controller depends on Babylon types, but world/scene coupling is already established. |
| Average | 7.0 |
🎯 Final Assessment
Overall Confidence Score: 85%
Confidence Breakdown:
- Code Quality: 85% (clean, well-commented, typechecks and builds; a few stale comments and unused helpers)
- Completeness: 90% (feature-complete per PR description; presets, water fix, debug tooling all wired)
- Risk Level: 80% (large additive PR but low game-logic risk; debug-only helpers are the main operational concern)
- Test Coverage: 40% (manual-test checklist recommended; light tests pass; no automated tests added)
Merge Readiness:
- All critical issues resolved
- SOLID average score >= 6.0
- Overall confidence >= 60%
- No security concerns
- Builds and typechecks passing
Verdict:
MERGE WITH FIXES — Address the remaining stale comments, dead-code exports, and the defensive graphics.clouds migration edge case before merging; all substantive issues from previous rounds are resolved.
- Fix opaqueMaterial getter comment (double-sided, not back-face culled)
- Fix water-pass constructor comment (StandardMaterial, not animated shader)
- migrateGraphics only accepts a string graphics.clouds so a stale
{ clouds: true } save can't leak a boolean through
- Remove dead exports: graphicsEqual and isBuiltinPreset
📋 SummaryNo linked issues found in the PR description. This PR adds a browser-friendly graphics/performance foundation for the Babylon.js voxel game: three graphics presets (Low/Medium/High), a runtime All verification commands pass: 📌 Review Metadata
This is the fifth review round. All substantive issues from prior rounds (preset render distance, magic-number water block id, chunk-border allocations, stale culling/water-brightness comments, shadow UI sync, shadow generator rebuild guard, foliage key parsing, cloud fog allocation, 🔴 Critical Issues (Must Fix - Blocks Merge)✅ All previously reported critical issues have been resolved. None identified.
|
| Principle | Score | Notes |
|---|---|---|
| Single Responsibility | 7 | GraphicsController cleanly separates settings data from engine application; Game.ts accumulates many debug hooks but they are isolated behind _ methods. |
| Open/Closed | 6 | New quality tiers are added via switch statements; extending them requires editing multiple files. |
| Liskov Substitution | 8 | No inheritance hierarchies introduced; new materials conform to existing usage patterns. |
| Interface Segregation | 7 | WaterMaterial exposes unused setDayNight/setFog no-ops purely for API compatibility. |
| Dependency Inversion | 7 | Settings are plain data; controller depends on Babylon types, but world/scene coupling is already established. |
| Average | 7.0 |
🎯 Final Assessment
Overall Confidence Score: 88%
Confidence Breakdown:
- Code Quality: 88% (clean, well-commented, typechecks and builds; only two stale doc comments remain)
- Completeness: 92% (feature-complete per PR description; presets, water fix, debug tooling all wired)
- Risk Level: 85% (large additive PR but low game-logic risk; debug-only helpers are the main operational concern)
- Test Coverage: 45% (manual-test checklist recommended; light tests pass; no automated tests added)
Merge Readiness:
- All critical issues resolved
- SOLID average score >= 6.0
- Overall confidence >= 60%
- No security concerns
- Builds and typechecks passing
Verdict:
MERGE WITH FIXES — Address the two remaining stale water-animation comments before merging; all substantive issues from previous rounds are resolved.





Summary
A browser-friendly graphics/performance foundation for the Babylon.js voxel game. Presets, a performance overlay, scalable settings, water/cloud/shadow quality tiers, and developer debug tooling. This branch also fixes a couple of regressions introduced and resolved during the pass (missing-terrain, invisible water, chunk seams).
What's included
Graphics settings & presets
localStorage; low-end device autodetect picks conservative defaultsPerformance overlay (F3)
Rendering
Water
StandardMaterialblue tint with an emissive floor + specular glint, lit by scene lights and fogged by scene fogClouds & shadows
Debug tooling
F3perf overlay ·Nwireframe ·Bchunk borders__voxl.water(),__voxl.waterOpaque(),__voxl.shadows(),__voxl.fog(),__voxl.post(),__voxl.dumpMaterials(),__voxl.waterStats(),__voxl.safeMode(),__voxl.terrainCulling(),__voxl.renderAllChunks()localStorage["voxl.debug"]="1"Safeguards
Notes / known limitations
__voxl.terrainCulling()toggle is provided to re-test safely. Real-time shadows currently affect nothing visible (terrain hasreceiveShadows=false, water/clouds/sky are custom/unlit) — they're GPU cost only; this is intentional pending a receiver pass.Verification
tsc --noEmitcleanvite buildsucceedsChanged files
16 modified + 4 new (
GraphicsController,GraphicsSettings,WaterMaterial,PerfOverlay,ChunkBorderOverlay).