Skip to content

Commit 09b2c9d

Browse files
authored
Merge pull request #63 from makr-code/copilot/improve-galaxy-and-game-experience
feat: Phase 5 post-processing — FilmGrain, ColorGrading, StarScintillation, DiskRotationParallax, JetLighting
2 parents 66f03f5 + 83c0f6a commit 09b2c9d

31 files changed

Lines changed: 4603 additions & 60 deletions

‎docs/technical/GALAXY_POSTPROCESS_ROADMAP.md‎

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,51 +99,65 @@ Progressively enhance the visual fidelity of the galaxy renderer with post-proce
9999

100100
### 3b. Volumetric Dust/Nebula Layers
101101
**Difficulty:** Medium | **Visual Impact:** 7/10 | **Performance Cost:** Low-Medium
102+
**Status:** ✅ IMPLEMENTED (2026-04)
102103

103-
- [ ] Generate procedural nebula textures (Perlin noise)
104-
- [ ] Create 2-3 semi-transparent quad layers
105-
- [ ] Position between disk + background
106-
- [ ] Animate slowly for parallax effect
104+
- [x] Generate procedural nebula textures (FBM/value noise — dustlayer.wgsl)
105+
- [x] 3 semi-transparent animated layers (foreground / mid / background)
106+
- [x] Slow scroll at different speeds for parallax effect
107+
- [x] Per-layer colour tint + opacity control
108+
- [x] `DustLayerPass.js` with `buildParamBlock()`, `update(dt)`, and `masterOpacity`
109+
- [x] 26 unit tests in `tests/js/dustlayerpass.test.js`
107110

108-
**Expected:** Nebelschichten zwischen Disk u. Hintergrund. Sichtbares Tiefenfeld.
111+
**Files Created:** `js/engine/post-effects/passes/DustLayerPass.js`, `js/engine/post-effects/shaders/dustlayer.wgsl`
109112

110113
---
111114

112115
### 3c. Motion Blur
113116
**Difficulty:** Medium | **Visual Impact:** 6/10 | **Performance Cost:** Medium
117+
**Status:** ✅ IMPLEMENTED (2026-04)
114118

115-
- [ ] Implement accumulation buffer approach
116-
- [ ] Capture previous frames (2-4 samples)
117-
- [ ] Blend with current frame
118-
- [ ] Gate by camera velocity (only when rotating fast)
119+
- [x] Velocity-based accumulation: samples along NDC camera displacement vector
120+
- [x] Velocity-threshold gate (blur skipped when camera is near-static)
121+
- [x] `setVelocity(ndcDeltaX, ndcDeltaY)` API for per-frame velocity supply
122+
- [x] `maxSamples` (2–8) scales with velocity magnitude
123+
- [x] `MotionBlurPass.js` with `buildParamBlock()` (8 floats)
124+
- [x] 22 unit tests in `tests/js/motionblurpass.test.js`
119125

120-
**Expected:** Rotation der Galaxie wird dynamischer + flüssiger. Subtile Bewegungshints.
126+
**Files Created:** `js/engine/post-effects/passes/MotionBlurPass.js`, `js/engine/post-effects/shaders/motionblur.wgsl`
121127

122128
---
123129

124130
## Phase 4: Advanced Cinematography 🎬
125131

126132
### 4a. Tone Mapping (Reinhard / ACES)
127133
**Difficulty:** Easy | **Visual Impact:** 5/10 | **Performance Cost:** Negligible
134+
**Status:** ✅ IMPLEMENTED (2026-04)
128135

129-
- [ ] Add tone-mapping shader pass
130-
- [ ] Configure curve (Reinhard or ACES)
131-
- [ ] Preserve star dynamic range
132-
- [ ] Prevent blown-out whites
136+
- [x] `ToneMappingPass.js` with Reinhard + ACES operators
137+
- [x] `ToneMappingMode` enum (REINHARD=0, ACES=1)
138+
- [x] `exposure` pre-multiplier for per-scene brightness
139+
- [x] sRGB gamma correction (x^(1/2.2)) after mapping
140+
- [x] `buildParamBlock()` (4 floats, std140-aligned)
141+
- [x] 18 unit tests in `tests/js/tonemappingpass.test.js`
133142

134-
**Expected:** HDR-Compression. Hellere Farben nicht blown-out, bessere Dynamik.
143+
**Files Created:** `js/engine/post-effects/passes/ToneMappingPass.js`, `js/engine/post-effects/shaders/tonemapping.wgsl`
135144

136145
---
137146

138147
### 4b. Lens Flare (on-hover starfield feature)
139148
**Difficulty:** Medium | **Visual Impact:** 7/10 | **Performance Cost:** Low (sprite-based)
149+
**Status:** ✅ IMPLEMENTED (2026-04)
140150

141-
- [ ] Create lens-flare sprite assets (starburst, rays, ghosts)
142-
- [ ] Position on selected/hovered star
143-
- [ ] Animate on selection
144-
- [ ] Optional: toggle via UI
151+
- [x] Multi-element procedural flare: starburst, glow disc, 1–4 ghost discs, streak halo
152+
- [x] Ghost discs reflected along lens axis (screen-centre direction) — authentic optics
153+
- [x] Up to 8 simultaneous sources (`MAX_FLARE_SOURCES=8`)
154+
- [x] `addSource(ndcX, ndcY, intensity, colorHex)` returns unique ID
155+
- [x] `updateSourcePosition(id, x, y)` for live camera-pan tracking
156+
- [x] `removeSource(id)` / `clearSources()` for lifecycle management
157+
- [x] `LensFlarePass.js` with `buildParamBlock()` (68 floats)
158+
- [x] 31 unit tests in `tests/js/lensflarepass.test.js`
145159

146-
**Expected:** Dramatische Lens-Artefakte beim Hover/Select. Nur auf hochhellen Sternen.
160+
**Files Created:** `js/engine/post-effects/passes/LensFlarePass.js`, `js/engine/post-effects/shaders/lensflare.wgsl`
147161

148162
---
149163

@@ -160,12 +174,13 @@ Progressively enhance the visual fidelity of the galaxy renderer with post-proce
160174
---
161175

162176
## Phase 5: Optional Enhancements 🌟
177+
**Status:** ✅ IMPLEMENTED (2026-04)
163178

164-
- [ ] **Star Scintillation:** Twinkle effect (variation in alpha per frame)
165-
- [ ] **Disk Rotation Parallax:** Closer layers rotate faster
166-
- [ ] **Jet Lighting:** Directional light affecting jets dynamically
167-
- [ ] **Color Grading:** LUT-based color correction for cohesive mood
168-
- [ ] **Film Grain:** Subtle noise overlay for gritty authenticity
179+
- [x] **Star Scintillation:** Twinkle effect — `StarScintillationPass.js` + `starscintillation.wgsl`; luminance-threshold hash noise modulates bright pixels; 20 unit tests
180+
- [x] **Disk Rotation Parallax:** Closer layers rotate faster — `DiskRotationParallaxPass.js` + `diskrotationparallax.wgsl`; Keplerian innerVelocity/outerVelocity UV warp; 22 unit tests
181+
- [x] **Jet Lighting:** Directional light affecting jets dynamically — `JetLightingPass.js` + `jetlighting.wgsl`; up to 4 AGN/black-hole jet sources with narrow-core + wide-penumbra model; 35 unit tests
182+
- [x] **Color Grading:** Analytical Brightness/Contrast/Saturation/HueShift — `ColorGradingPass.js` + `colorgrading.wgsl`; LGG model (DaVinci Resolve style); 17 unit tests
183+
- [x] **Film Grain:** Temporal hash noise overlay — `FilmGrainPass.js` + `filmgrain.wgsl`; luminance-weighted grain, intensity/speed/size controls; 20 unit tests
169184

170185
---
171186

0 commit comments

Comments
 (0)