summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
22 hoursfeat: implement beat-based timing systemskal
BREAKING CHANGE: Timeline format now uses beats as default unit ## Core Changes **Uniform Structure (32 bytes maintained):** - Added `beat_time` (absolute beats for musical animation) - Added `beat_phase` (fractional 0-1 for smooth oscillation) - Renamed `beat` → `beat_phase` - Kept `time` (physical seconds, tempo-independent) **Seq Compiler:** - Default: all numbers are beats (e.g., `5`, `16.5`) - Explicit seconds: `2.5s` suffix - Explicit beats: `5b` suffix (optional clarity) **Runtime:** - Effects receive both physical time and beat time - Variable tempo affects audio only (visual uses physical time) - Beat calculation from audio time: `beat_time = audio_time * BPM / 60` ## Migration - Existing timelines: converted with explicit 's' suffix - New content: use beat notation (musical alignment) - Backward compatible via explicit notation ## Benefits - Musical alignment: sequences sync to bars/beats - BPM independence: timing preserved on BPM changes - Shader capabilities: animate to musical time - Clean separation: tempo scaling vs. visual rendering ## Testing - Build: ✅ Complete - Tests: ✅ 34/36 passing (94%) - Demo: ✅ Ready handoff(Claude): Beat-based timing system implemented. Variable tempo only affects audio sample triggering. Visual effects use physical_time (constant) and beat_time (musical). Shaders can now animate to beats. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
22 hoursfeat: Timeline editor UI improvementsskal
- Sequences start collapsed by default for better overview - Move controls to header for vertical space savings - Remove "Pixels per second" label (redundant with zoom %) - Move properties panel to bottom left - Update collapse arrows for vertical layout (▼/▲) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
23 hoursfeat: timeline editor improvements - sticky ticks, grid, collapseskal
- Sticky time markers stay visible when scrolling - Faint vertical grid lines aligned with ticks for better alignment - Collapsible sequences via double-click (35px collapsed state) - Updated all references from demo.seq to timeline.seq - Consolidated and tightened documentation - Fixed _collapsed initialization bug Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
23 hoursfix: CNN bias accumulation and output format improvementsskal
- Fix bias division bug: divide by num_positions to compensate for shader loop accumulation (affects all layers) - train_cnn.py: Save RGBA output preserving alpha channel from input - Add --debug-hex flag to both tools for pixel-level debugging - Remove sRGB/linear_png debug code from cnn_test - Regenerate weights with corrected bias export Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
27 hoursfix: Release cached samplers before WGPU shutdownskal
SamplerCache singleton never released samplers, causing device to retain references at shutdown. Add clear() method and call before fixture cleanup. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
27 hoursfix: Resolve WGPU threading crash in cnn_testskal
- Release queue reference after submit in texture_readback - Add final wgpuDevicePoll before cleanup to sync GPU work Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
29 hoursupdate cnn codeskal
36 hoursadd --save-intermediates to train.py and cnn_testskal
39 hoursfix: CNN test tool GPU readback with wgpuDevicePollskal
Fixed buffer mapping callback mode mismatch causing Unknown status. Changed from WaitAnyOnly+ProcessEvents to AllowProcessEvents+DevicePoll. Readback now functional but CNN output incorrect (all white). Issue isolated to tool-specific binding/uniform setup - CNNEffect in demo works correctly. Technical details: - WGPUCallbackMode_WaitAnyOnly requires wgpuInstanceWaitAny - Using wgpuInstanceProcessEvents with WaitAnyOnly never fires callback - Fixed by using AllowProcessEvents mode + wgpuDevicePoll - Removed debug output and platform warnings Status: 36/36 tests pass, readback works, CNN shader issue remains. handoff(Claude): CNN test tool readback fixed, output debugging needed
39 hoursdebug: Add shader load verification and GPU sync to CNN test toolskal
Debug additions: - Print loaded shader size (confirms assets work: 2274 bytes) - Add wgpuDevicePoll after each layer for GPU sync - Verify shader loading with null/empty checks Findings: - Shader loads correctly (2274 bytes) - GPU commands execute without validation errors - Pipeline compiles successfully - Output remains all-black despite correct architecture Likely causes: - Render setup differs from demo's CNNEffect - Possible issue with bind group bindings - Fragment shader may not be executing - Texture sampling might be failing Next steps: - Create minimal solid-color render test - Compare bind group setup with working CNNEffect - Add fragment shader debug output (if possible) - Test with demo's CNN effect to verify weights/shader work Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
39 hoursfix: CNN test tool ping-pong bug and RGBA16Float intermediatesskal
Bugfixes: - Fixed ping-pong logic: update current_input BEFORE flipping dst_idx - Use RGBA16Float for intermediate layers (preserve [-1,1] range from tanh) - Separate BGRA8Unorm final output texture for readback - Create two pipelines: intermediate (RGBA16Float) and final (BGRA8Unorm) - Fix all cleanup code to reference correct pipeline variables Implementation: - Intermediate textures use RGBA16Float to avoid clamping [-1,1] → [0,1] - Final layer renders to separate BGRA8Unorm texture - Correct texture view descriptors for each format - Layer 0-1: render to RGBA16Float ping-pong textures - Layer 2: render to BGRA8Unorm output texture Documentation: - Added CNN testing section to doc/HOWTO.md - Updated CNN_TEST_TOOL.md with ground-truth comparison workflow - Noted remaining black output bug (under investigation) Status: - Tool compiles and runs without GPU errors - Architecture correct: ping-pong, format conversion, separate pipelines - Output still all-black (unknown cause, needs debugging) - All 36 tests still pass handoff(Claude): CNN test tool bugfixes complete, black output remains Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
39 hoursfeat: Add CNN shader testing tool with GPU texture readbackskal
Core GPU Utility (texture_readback): - Reusable synchronous texture-to-CPU readback (~150 lines) - STRIP_ALL guards (0 bytes in release builds) - Handles COPY_BYTES_PER_ROW_ALIGNMENT (256-byte alignment) - Refactored OffscreenRenderTarget to use new utility CNN Test Tool (cnn_test): - Standalone PNG→3-layer CNN→PNG/PPM tool (~450 lines) - --blend parameter (0.0-1.0) for final layer mixing - --format option (png/ppm) for output format - ShaderComposer integration for include resolution Build Integration: - Added texture_readback.cc to GPU_SOURCES (both sections) - Tool target with STB_IMAGE support Testing: - All 36 tests pass (100%) - Processes 64×64 and 555×370 images successfully - Ground-truth validation setup complete Known Issues: - BUG: Tool produces black output (uninitialized input texture) - First intermediate texture not initialized before layer loop - MSE 64860 vs Python ground truth (expected <10) - Fix required: Copy input to intermediate[0] before processing Documentation: - doc/CNN_TEST_TOOL.md - Full technical reference - Updated PROJECT_CONTEXT.md and COMPLETED.md handoff(Claude): CNN test tool foundation complete, needs input init bugfix Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysfeat: Add --shader-only option to convert_shadertoy.pyskal
Allows regenerating just the .wgsl shader file without touching .h/.cc files when iterating on shader code. Usage: ./tools/shadertoy/convert_shadertoy.py shader.txt EffectName --shader-only Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysfix: Flip Y-axis to match ShaderToy coordinate conventionskal
ShaderToy uses bottom-left origin with Y-up, but our system uses top-left origin with Y-down. Added Y-flip in fragment shader to correctly display ShaderToy effects. **Changes:** - workspaces/main/shaders/scene1.wgsl: Flip Y before coordinate conversion - tools/shadertoy/convert_shadertoy.py: Generate Y-flip in all conversions **Formula:** ```wgsl let flipped = vec2<f32>(p.x, uniforms.resolution.y - p.y); ``` This ensures ShaderToy shaders display right-side up. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysrefactor: Improve convert_shadertoy.py to generate compile-ready codeskal
Major improvements to reduce manual code changes after conversion: **Scene vs Post-Process Detection:** - Added --post-process flag (default: scene effect) - Scene effects: Simple pattern like HeptagonEffect (no texture input) - Post-process effects: Uses PostProcessEffect base class **Generated Code Now Compiles As-Is:** - Scene: Uses gpu_create_render_pass() helper - Post-process: Uses create_post_process_pipeline() helper - No manual Effect base class rewrites needed - Correct shader bindings for each type **Improved WGSL Conversion:** - Better mainImage extraction and conversion - Proper fragCoord -> p.xy mapping - Handles iResolution/iTime -> uniforms automatically - Fixed return statements (fragColor = ... -> return ...) - Preserves helper functions from original shader **Better Instructions:** - Shows exact asset.txt format with SHADER_ prefix - Includes shader declaration/definition steps - Indicates correct test list (scene_effects vs post_process_effects) **Example:** ```bash ./tools/shadertoy/convert_shadertoy.py shader.txt MyEffect # Generates compile-ready scene effect ./tools/shadertoy/convert_shadertoy.py blur.txt Blur --post-process # Generates compile-ready post-process effect ``` Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysdocs: Fix EFFECT keyword syntax and add automation-friendly workflowskal
Fix EFFECT keyword format across all documentation and scripts - priority modifier (+/=/–) is required but was missing from examples. **Documentation fixes:** - doc/HOWTO.md: Added missing + to EFFECT example - doc/RECIPE.md: Added priority modifiers to examples - tools/shadertoy/README.md: Fixed test path, clarified workflow - tools/shadertoy/convert_shadertoy.py: Updated output instructions **New automation guide:** - doc/EFFECT_WORKFLOW.md: Complete step-by-step checklist for AI agents - Exact file paths and line numbers - Common issues and fixes - Asset ID naming conventions - CMakeLists.txt dual-section requirement - Test list instructions (post_process_effects vs scene_effects) **Integration:** - CLAUDE.md: Added EFFECT_WORKFLOW.md to Tier 2 (always loaded) - doc/AI_RULES.md: Added "Adding Visual Effects" quick reference - README.md: Added EFFECT_WORKFLOW.md to documentation list **CMakeLists.txt:** - Disabled incomplete cube_sphere_effect.cc (ShaderToy conversion WIP) **Timeline:** - Commented out incomplete CubeSphereEffect - Removed obsolete constructor argument Fixes #issue-with-effect-syntax Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysfeat: Add ShaderToy conversion toolsskal
Add automated conversion pipeline for ShaderToy shaders to demo effects: - convert_shadertoy.py: Automated code generation script - Manual templates: Header, implementation, and WGSL boilerplate - Example shader: Test case for conversion workflow - README: Complete conversion guide with examples Handles basic GLSL→WGSL conversion (types, uniforms, mainImage extraction). Manual fixes needed for fragColor returns and complex type inference. Organized under tools/shadertoy/ for maintainability. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysfix: Capture scene framebuffer before post-processing for CNN effectskal
CNNEffect's "original" input was black because FadeEffect (priority 1) ran before CNNEffect (priority 1), fading the scene. Changed framebuffer capture to use framebuffer_a (scene output) instead of current_input (post-chain). Also add seq_compiler validation to detect post-process priority collisions within and across concurrent sequences, preventing similar render order issues. Updated stub_types.h WGPULoadOp enum values to match webgpu.h spec. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 daysfeat: Add multi-layer CNN support with framebuffer capture and blend controlskal
Implements automatic layer chaining and generic framebuffer capture API for multi-layer neural network effects with proper original input preservation. Key changes: - Effect::needs_framebuffer_capture() - generic API for pre-render capture - MainSequence: auto-capture to "captured_frame" auxiliary texture - CNNEffect: multi-layer support via layer_index/total_layers params - seq_compiler: expands "layers=N" to N chained effect instances - Shader: @binding(4) original_input available to all layers - Training: generates layer switches and original input binding - Blend: mix(original, result, blend_amount) uses layer 0 input Timeline syntax: CNNEffect layers=3 blend=0.7 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysdocs: Reorganize shader editor documentationskal
README.md: Streamlined quick start and feature overview SHADER_EDITOR_DETAILS.md: Technical reference (architecture, uniforms, examples) SHADER_EDITOR_PLAN.md: Development roadmap with 5 phases Summary of implemented features: - Live WebGPU preview (1280×720, autoplay) - Syntax highlighting (placeholder-based, prevents overlap) - #include composition (recursive resolution) - Animation controls (time, beat, audio_peak) - File I/O (load/save .wgsl) Next priorities: 1. Multi-resolution support 2. Improved syntax highlighting 3. Texture upload Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Use placeholder technique to prevent syntax highlighting overlapskal
Replace comments/strings with placeholders, highlight rest, restore. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysrefactor: Improve syntax highlighting to avoid overlapping matchesskal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat: Add WGSL syntax highlightingskal
Overlay highlighting: keywords, types, attributes, functions, numbers, comments. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysrefactor: Increase editor pane size by 20% (36% → 43%)skal
Preview: 57%, Editor: 43% Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Remove resolutionSelect references after removing UI elementskal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat: Remove resolution selector, enable autoplay on loadskal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Use 16:9 aspect ratio and object-fit contain for canvasskal
Default resolution: 1280x720 (16:9) Canvas uses object-fit: contain to preserve aspect ratio Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Canvas fills available height instead of maintaining square aspectskal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Reference texture/sampler in default shader for bind group layoutskal
WebGPU auto layout requires all bindings to be used in shader. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Use var instead of let for mutable uv in default shaderskal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysrefactor: Adjust shader editor layout and add default animationskal
- Editor pane: 30% → 36% (20% larger) - Preview pane: 70% → 64% - Default shader: animated gradient + pulsing circle (was plain color) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat: Add HTML WGSL shader editor toolskal
ShaderToy-like web tool for live WGSL shader editing with WebGPU preview. Features: - Live WebGPU preview with real-time shader updates - Shader composition: #include directive support - Animation controls: time, loop_time (0..1), audio_peak - File I/O: Load/save .wgsl files - CommonUniforms binding (resolution, time, beat, audio_intensity) - Keyboard shortcuts: Ctrl+S (save), Ctrl+O (load), Space (play/pause) Single-file HTML (no build step, no CORS issues). handoff(Claude): Implemented HTML WGSL shader editor per plan Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfix: Strip priority comments from effect args in .seq exportskal
Remove '# Priority: X' comments from effect arguments during timeline export to keep .seq files clean. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat(gpu): Phase 2 - Add gen_perlin and gen_grid GPU compute shadersskal
Complete Phase 2 implementation: - gen_perlin.wgsl: FBM with configurable octaves, amplitude decay - gen_grid.wgsl: Grid pattern with configurable spacing/thickness - TextureManager extensions: create_gpu_perlin_texture(), create_gpu_grid_texture() - Asset packer now validates gen_noise, gen_perlin, gen_grid for PROC_GPU() - 3 compute pipelines (lazy-init on first use) Shader parameters: - gen_perlin: seed, frequency, amplitude, amplitude_decay, octaves (32 bytes) - gen_grid: width, height, grid_size, thickness (16 bytes) test_3d_render migration: - Replaced CPU sky texture (gen_perlin) with GPU version - Replaced CPU noise texture (gen_noise) with GPU version - Added new GPU grid texture (256x256, 32px grid, 2px lines) Size impact: - gen_perlin.wgsl: ~200 bytes (compressed) - gen_grid.wgsl: ~100 bytes (compressed) - Total Phase 2 code: ~300 bytes - Cumulative (Phase 1+2): ~600 bytes Testing: - All 34 tests passing (100%) - test_gpu_procedural validates all generators - test_3d_render uses 3 GPU textures (noise, perlin, grid) Next: Phase 3 - Variable dimensions, async generation, pipeline caching Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat(gpu): Add GPU procedural texture generation systemskal
Phase 1 implementation complete: - GPU compute shader for noise generation (gen_noise.wgsl) - TextureManager extensions: create_gpu_noise_texture(), dispatch_noise_compute() - Asset packer PROC_GPU() syntax support with validation - ShaderComposer integration for #include resolution - Zero CPU memory overhead (GPU-only textures) - Init-time and on-demand generation modes Technical details: - 8×8 workgroup size for 256×256 textures - UniformBuffer for params (width, height, seed, frequency) - Storage texture binding (rgba8unorm, write-only) - Lazy pipeline compilation on first use - ~300 bytes code (Phase 1) Testing: - New test: test_gpu_procedural.cc (passes) - All 34 tests passing (100%) Future phases: - Phase 2: Add gen_perlin, gen_grid compute shaders - Phase 3: Variable dimensions, async generation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3 daysfeat: WGSL Uniform Buffer Validation & Consolidation (Task #75)skal
- Added to validate WGSL/C++ struct alignment. - Integrated validation into . - Standardized uniform usage in , , , . - Renamed generic to specific names in WGSL and C++ to avoid collisions. - Added and updated . - handoff(Gemini): Completed Task #75.
3 daysfix: Resolve DemoEffectsTest SEGFAULT and update GEMINI.mdskal
- Fixed a persistent SEGFAULT in DemoEffectsTest, allowing all 33 tests to pass (100% test coverage). - The fix involved addressing uniform buffer alignment, resource initialization order, and minor code adjustments in affected effects. - Updated GEMINI.md to reflect the completion of Task #74 and set the focus on Task #75: WGSL Uniform Buffer Validation & Consolidation. handoff(Gemini): Addressed the DemoEffectsTest crash and updated the project state. Next up is Task #75 for robust uniform buffer validation.
4 daysfeat(gpu): Add VignetteEffect and related filesskal
- Implemented VignetteEffect, including its shader, parameters, and sequence integration. - Added VignetteEffect to demo_effects.h, shaders.cc/h, and asset definitions. - Updated seq_compiler to handle VignetteEffect parameters. - Added VignetteEffect to test suite and updated expected counts. - Ensured all changes build and tests pass. - Added vignette_effect.cc implementation file. - Updated CMakeLists.txt to include the new effect file. - Updated assets/demo.seq to include the VignetteEffect. - Updated assets/final/demo_assets.txt with the new shader asset.
4 daysfeat(gpu): Add parameter-driven GaussianBlurEffectskal
Extends shader parametrization system to GaussianBlurEffect with strength parameter (Task #73 continued). Changes: - Added GaussianBlurParams struct (strength, default: 2.0f) - Added GaussianBlurUniforms with proper WGSL alignment (32 bytes) - Updated shader to use parameterized strength instead of hardcoded 2.0 - Extended seq_compiler to parse strength parameter - Updated demo.seq with 2 parameterized instances: * Line 38: strength=3.0 (stronger blur for particles) * Line 48: strength=1.5 (subtle blur) Technical details: - Backward-compatible default constructor maintained - Migrated from raw buffer to UniformBuffer<GaussianBlurUniforms> - Shader replaces 'let base_size = 2.0' with 'uniforms.strength' - Generated code creates GaussianBlurParams initialization Testing: - All 32/32 tests pass - Demo runs without errors - Generated code verified correct Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
4 daysfeat(gpu): Add parameter-driven ChromaAberrationEffectskal
Implements Task #73 - Extends shader parametrization system to ChromaAberrationEffect following the FlashEffect pattern. Changes: - Added ChromaAberrationParams struct (offset_scale, angle) - Added ChromaUniforms with proper WGSL alignment (32 bytes) - Updated shader to compute offset direction from angle parameter - Extended seq_compiler to parse offset/angle parameters - Updated demo.seq with 2 parameterized instances: * Line 50: offset=0.03 angle=0.785 (45° diagonal, stronger) * Line 76: offset=0.01 angle=1.57 (90° vertical, subtle) Technical details: - Backward-compatible default constructor maintained - Migrated from raw buffer to UniformBuffer<ChromaUniforms> - Shader computes direction: vec2(cos(angle), sin(angle)) - Generated code creates ChromaAberrationParams initialization Testing: - All 32/32 tests pass - Demo runs without errors - Binary size: 5.6M stripped (~200-300 bytes impact) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
4 daysfeat(gpu): Implement shader parametrization systemskal
Phases 1-5: Complete uniform parameter system with .seq syntax support **Phase 1: UniformHelper Template** - Created src/gpu/uniform_helper.h - Type-safe uniform buffer wrapper - Generic template eliminates boilerplate: init(), update(), get() - Added test_uniform_helper (passing) **Phase 2: Effect Parameter Structs** - Added FlashEffectParams (color[3], decay_rate, trigger_threshold) - Added FlashUniforms (shader data layout) - Backward compatible constructor maintained **Phase 3: Parameterized Shaders** - Updated flash.wgsl to use flash_color uniform (was hardcoded white) - Shader accepts any RGB color via uniforms.flash_color **Phase 4: Per-Frame Parameter Computation** - Parameters computed dynamically in render(): - color[0] *= (0.5 + 0.5 * sin(time * 0.5)) - color[1] *= (0.5 + 0.5 * cos(time * 0.7)) - color[2] *= (1.0 + 0.3 * beat) - Uses UniformHelper::update() for type-safe writes **Phase 5: .seq Syntax Extension** - New syntax: EFFECT + FlashEffect 0 1 color=1.0,0.5,0.5 decay=0.95 - seq_compiler parses key=value pairs - Generates parameter struct initialization: ```cpp FlashEffectParams p; p.color[0] = 1.0f; p.color[1] = 0.5f; p.color[2] = 0.5f; p.decay_rate = 0.95f; seq->add_effect(std::make_shared<FlashEffect>(ctx, p), ...); ``` - Backward compatible (effects without params use defaults) **Files Added:** - src/gpu/uniform_helper.h (generic template) - src/tests/test_uniform_helper.cc (unit test) - doc/SHADER_PARAMETRIZATION_PLAN.md (design doc) **Files Modified:** - src/gpu/effects/flash_effect.{h,cc} (parameter support) - src/gpu/demo_effects.h (include flash_effect.h) - tools/seq_compiler.cc (parse params, generate code) - assets/demo.seq (example: red-tinted flash) - CMakeLists.txt (added test_uniform_helper) - src/tests/offscreen_render_target.cc (GPU test fix attempt) - src/tests/test_effect_base.cc (graceful mapping failure) **Test Results:** - 31/32 tests pass (97%) - 1 GPU test failure (pre-existing WebGPU buffer mapping issue) - test_uniform_helper: passing - All parametrization features functional **Size Impact:** - UniformHelper: ~200 bytes (template) - FlashEffect params: ~50 bytes - seq_compiler: ~300 bytes - Net impact: ~400-500 bytes (within 64k budget) **Benefits:** ✅ Artist-friendly parameter tuning (no code changes) ✅ Per-frame dynamic parameter computation ✅ Type-safe uniform management ✅ Multiple effect instances with different configs ✅ Backward compatible (default parameters) **Next Steps:** - Extend to other effects (ChromaAberration, GaussianBlur) - Add more parameter types (vec2, vec4, enums) - Document syntax in SEQUENCE.md handoff(Claude): Shader parametrization complete, ready for extension to other effects
4 daysfeat: Integrate plane_distance into renderer and scene loaderskal
This commit integrates the plane_distance functionality by: - Adding shared_user_data to Object3D for storing type-specific data. - Modifying SceneLoader to read and store plane_distance in shared_user_data for PLANE objects. - Updating ObjectData struct in renderer.h to use params.x for object type and params.y for plane_distance. - Modifying Renderer3D::update_uniforms to populate ObjectData::params.y with plane_distance for PLANE objects. - Adjusting blender_export.py to correctly export plane_distance and reorder quaternion components. A manual step is required to update WGSL shaders to utilize ObjectData.params.y for plane distance calculations.
4 daysfeat(tools): Add effect depth analysis to seq_compilerskal
Adds --analyze flag to seq_compiler to identify performance bottlenecks by analyzing how many effects run simultaneously at each point in the demo. Features: - Samples timeline at 10 Hz (every 0.1s) - Counts overlapping effects at each sample point - Generates histogram of effect depth distribution - Identifies bottleneck periods (>5 concurrent effects) - Reports max concurrent effects with timestamps - Lists top 10 bottleneck peaks with effect names Analysis Results for Current Demo (demo.seq): - Max concurrent effects: 11 at t=8.8s - 28 bottleneck periods detected (>5 effects) - 29.6% of demo has 7+ effects running (critical) - Most intensive section: 8b-12b (4-6 seconds) Most Used Effects: - GaussianBlurEffect: ~10 instances (optimization target) - HeptagonEffect: ~9 instances - ThemeModulationEffect: ~7 instances Usage: ./build/seq_compiler assets/demo.seq --analyze ./build/seq_compiler assets/demo.seq --analyze --gantt-html=out.html Files Modified: - tools/seq_compiler.cc: Added analyze_effect_depth() function - EFFECT_DEPTH_ANALYSIS.md: Detailed analysis report + recommendations - timeline_analysis.html: Visual Gantt chart (example output) This helps identify: - Which sequences have too many overlapping effects - When to stagger effect timing to reduce GPU load - Which effects appear most frequently (optimization targets) Next steps: Profile actual GPU time per effect to validate bottlenecks.
4 daysfeat(audio, tools): Add Task #72 and enhance Blender exporterskal
- Add Task #72 (Audio Pipeline Streamlining) to TODO.md and PROJECT_CONTEXT.md. - Update blender_export.py to support 'EMPTY' objects for planes and export 'plane_distance'.
5 daysstyle: Apply clang-format to all source filesskal
5 daysfeat(3d): Implement Blender export and binary scene loading pipelineskal
5 daysrefactor(audio): Convert tracker to unit-less timing systemskal
Changes tracker timing from beat-based to unit-less system to separate musical structure from BPM-dependent playback speed. TIMING CONVENTION: - 1 unit = 4 beats (by convention) - Conversion: seconds = units * (4 / BPM) * 60 - At 120 BPM: 1 unit = 2 seconds BENEFITS: - Pattern structure independent of BPM - BPM changes only affect playback speed, not structure - Easier pattern composition (0.00-1.00 for typical 4-beat pattern) - Fixes issue where patterns played for 2s instead of expected duration DATA STRUCTURES (tracker.h): - TrackerEvent.beat → TrackerEvent.unit_time - TrackerPattern.num_beats → TrackerPattern.unit_length - TrackerPatternTrigger.time_sec → TrackerPatternTrigger.unit_time RUNTIME (tracker.cc): - Added BEATS_PER_UNIT constant (4.0) - Convert units to seconds at playback time using BPM - Pattern remains active for full unit_length duration - Fixed premature pattern deactivation bug COMPILER (tracker_compiler.cc): - Parse LENGTH parameter from PATTERN lines (defaults to 1.0) - Parse unit_time instead of beat values - Generate code with unit-less timing ASSETS: - test_demo.track: converted to unit-less (8 score triggers) - music.track: converted to unit-less (all patterns) - Events: beat/4 conversion (e.g., beat 2.0 → unit 0.50) - Score: seconds/unit_duration (e.g., 4s → 2.0 units at 120 BPM) VISUALIZER (track_visualizer/index.html): - Parse LENGTH parameter and BPM directive - Convert unit-less time to seconds for rendering - Update tick positioning to use unit_time - Display correct pattern durations DOCUMENTATION (doc/TRACKER.md): - Added complete .track format specification - Timing conversion reference table - Examples with unit-less timing - Pattern LENGTH parameter documentation FILES MODIFIED: - src/audio/tracker.{h,cc} (data structures + runtime conversion) - tools/tracker_compiler.cc (parser + code generation) - assets/{test_demo,music}.track (converted to unit-less) - tools/track_visualizer/index.html (BPM-aware rendering) - doc/TRACKER.md (format documentation) - convert_track.py (conversion utility script) TEST RESULTS: - test_demo builds and runs correctly - demo64k builds successfully - Generated code verified (unit-less values in music_data.cc) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5 daysRevert "fix(track_visualizer): Convert beats to seconds correctly"skal
This reverts commit de6fc77a1b4becf5841881fa4fb7bd78141d81dc.
5 daysfix(track_visualizer): Convert beats to seconds correctlyskal
- Added beatsToSeconds() helper function - Renamed getPatternDuration to getPatternDurationBeats for clarity - Pattern durations now correctly calculated in seconds (was treating beats as seconds) - Fixes visualization showing incorrect pattern box widths
5 daysfeat(tools): Add music track visualizerskal
Created HTML-based visualizer for .track files with: Features: - Load .track files via file input button - Zoomable timeline (horizontal zoom with mouse wheel) - Scrollable view (Shift+wheel for horizontal scroll) - Vertical zoom controls for pattern boxes - Click & drag panning Visualization: - Color-coded pattern boxes (deterministic HSL colors from name hash) - Automatic stack-based layout (prevents overlapping patterns) - Beat grid lines within each pattern (vertical lines at beat boundaries) - Beat numbers displayed when zoomed in - Sample ticks showing when events trigger (height varies with volume) - Alternating beat background (full-height rectangles for easy counting) - Time ruler with second markers at top Technical: - Single standalone HTML file (13KB, no dependencies) - Pure HTML5 Canvas + JavaScript - Parses .track format: SAMPLE, PATTERN, SCORE sections - Responsive canvas sizing based on track duration - 120 BPM timing (2 beats per second) Files: - tools/track_visualizer/index.html (visualizer) - tools/track_visualizer/README.md (documentation) Usage: Open index.html in browser, load assets/music.track