Summary
Replace the simple 0.85 fade factor in the branched flow clear pass with proper temporal accumulation using double-buffered caustic textures. This allows tracing fewer rays per frame (8K-16K) while maintaining visual quality by accumulating deposits over 10-20 frames.
Current Behavior
- Single caustic buffer with
atomicAdd deposits and 0.85 multiplicative fade
- Default 8K rays/frame (reduced from 32K) with fade-based persistence
- High atomic contention at high ray counts
Proposed Change
- Create two caustic buffers (A and B)
- Each frame: read from A, deposit into a separate buffer, blend into B
- Blend pass:
B[i] = alpha * A[i] + (1-alpha) * new_deposits[i]
- Swap A and B each frame
- Clear accumulation when laser parameters change (entry point, beam angle)
Acceptance Criteria
Context
From deep review plan item 3.3. Estimated benefit: 4-8x fewer rays per frame for equivalent visual quality. Reduces both compute time and atomic contention.
Files: src/render/branched_flow.rs, src/render/shaders/branched_flow_compute.wgsl, src/render/pipeline.rs
Summary
Replace the simple 0.85 fade factor in the branched flow clear pass with proper temporal accumulation using double-buffered caustic textures. This allows tracing fewer rays per frame (8K-16K) while maintaining visual quality by accumulating deposits over 10-20 frames.
Current Behavior
atomicAdddeposits and 0.85 multiplicative fadeProposed Change
B[i] = alpha * A[i] + (1-alpha) * new_deposits[i]Acceptance Criteria
Context
From deep review plan item 3.3. Estimated benefit: 4-8x fewer rays per frame for equivalent visual quality. Reduces both compute time and atomic contention.
Files:
src/render/branched_flow.rs,src/render/shaders/branched_flow_compute.wgsl,src/render/pipeline.rs