summaryrefslogtreecommitdiff
path: root/tools/shadertoy
AgeCommit message (Collapse)Author
13 hoursfeat: 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>
13 hoursfix: 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>
13 hoursrefactor: 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>
13 hoursdocs: 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>
14 hoursfeat: 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>