Skip to content

perf + lighting: PCFSoft shadows, fill light, tighter frustum, quality-tiered shadow maps - #1

Closed
benjosua with Copilot wants to merge 33 commits into
mainfrom
copilot/optimize-threejs-scene-performance
Closed

perf + lighting: PCFSoft shadows, fill light, tighter frustum, quality-tiered shadow maps#1
benjosua with Copilot wants to merge 33 commits into
mainfrom
copilot/optimize-threejs-scene-performance

Conversation

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown

The Three.js scene had a fixed-resolution shadow map regardless of quality tier, an oversized shadow frustum wasting texel density, only a single key light (flat-looking scene), and a per-frame fog/background update running unconditionally every tick.

Performance

  • Remove WorldBackground.useFrame — was calling scene.background.set() + fog updates every frame; the declarative JSX and existing useEffect already cover this
  • Quality-tiered shadow maps (performance.js) — shadowMapSize 512 / 1024 / 2048 for low / medium / high; was hard-coded to 1024 for all tiers
  • Tighter shadow frustum — ±7/±8 → ±5/±6 world units; fully covers the play area while reducing projected area ~40%, giving ~1.7× better shadow-texel density at the same resolution
  • Ball sphere segments — 24×18 → 18×12; saves ~600 tris/frame, imperceptible at gameplay distances

Shadow quality

  • PCFSoftShadowMap on the Canvas — replaces default hard-edge PCF with soft penumbrae
  • shadow-radius={2} on the key light — adds PCFSoft blur for smoother edges

Lighting

  • Fill/rim light — cool-tinted (#b8cfe8) directional from [-3, 5, -4] at intensity 0.55, opposite the warm key at [4.5, 7.5, 5.5]; gives side-face separation on paddles/net that was completely absent before; subtly reacts to arenaFx.heat and flash
  • Exposed as TUNING.lighting.fill / fillColor with matching debug-panel controls in the LightingPost folder

Copilot AI changed the title Improve Three.js scene performance, shadow quality and lighting perf + lighting: PCFSoft shadows, fill light, tighter frustum, quality-tiered shadow maps Jun 13, 2026
Copilot AI requested a review from benjosua June 13, 2026 11:27
@benjosua benjosua closed this Aug 20, 2026
@benjosua
benjosua deleted the copilot/optimize-threejs-scene-performance branch August 20, 2026 09:49
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.

2 participants