summaryrefslogtreecommitdiff
path: root/common/shaders
AgeCommit message (Collapse)Author
23 hoursfeat(gpu): add two-pass raymarching infrastructureskal
Add RayMarchResult struct and functions for deferred SDF rendering: - rayMarchWithID() tracks object ID and distance_max - reconstructPosition(), normalWithID(), shadowWithStoredDistance() - Pass 1: store geometry data, Pass 2: reuse for shading Add WGSL style rule: prefer return values over pointers for small structs (≤16 bytes). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
23 hoursfeat(gpu): add SDF camera infrastructure and effect base classskal
Add unified camera system for SDF raymarching effects: - CameraParams struct (80 bytes): inv_view matrix + FOV/near/far/aspect - SDFEffect base class: manages camera uniform, provides update_camera() helpers - camera_common.wgsl: getCameraRay(), position/forward/up/right extractors - SDFTestEffect: working example with orbiting camera + animated sphere Refactor effect headers: - Extract class definitions from demo_effects.h to individual .h files - Update includes in .cc files to use specific headers - Cleaner compilation dependencies, faster incremental builds Documentation: - Add SDF_EFFECT_GUIDE.md with complete workflow - Update ARCHITECTURE.md, UNIFORM_BUFFER_GUIDELINES.md - Update EFFECT_WORKFLOW.md, CONTRIBUTING.md Tests: 34/34 passing, SDFTestEffect validated Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
27 hoursrefactor(wgsl): consolidate SDF shapes into single common fileskal
Merge sdf_primitives.wgsl into math/sdf_shapes.wgsl to eliminate duplication and establish single source of truth for all SDF functions. Changes: - Delete common/shaders/sdf_primitives.wgsl (duplicate of math/sdf_shapes.wgsl) - Add sdBox2D() and sdEllipse() to math/sdf_shapes.wgsl - Update ellipse.wgsl (main/test) to use #include "math/sdf_shapes" - Update scene1.wgsl to use math/sdf_shapes instead of sdf_primitives - Rename asset SHADER_SDF_PRIMITIVES → SHADER_SDF_SHAPES - Update shader registration and tests Impact: - ~60 lines eliminated from ellipse shaders - Single source for 3D primitives (sphere, box, torus, plane) and 2D (box, ellipse) - Consistent include path across codebase All tests passing (34/34). handoff(Claude): SDF shapes consolidated to math/sdf_shapes.wgsl Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
27 hoursrefactor(wgsl): modularize common shader functionsskal
Extracted common WGSL functions into separate files in `common/shaders/` to improve reusability and maintainability. - Created `common/shaders/render/fullscreen_vs.wgsl` for a reusable fullscreen vertex shader. - Created `common/shaders/math/color.wgsl` for color conversion and tone mapping functions. - Created `common/shaders/math/utils.wgsl` for general math utilities. - Created `common/shaders/render/raymarching.wgsl` for SDF raymarching logic. - Updated multiple shaders to use these new common snippets via `#include`. - Fixed the shader asset validation test to correctly handle shaders that include the common vertex shader. This refactoring makes the shader code more modular and easier to manage.
2 daysRemediation: Implement shared common/shaders/ directoryskal
Eliminates 36 duplicate shader files across workspaces. Structure: - common/shaders/{math,render,compute}/ - Shared utilities (20 files) - workspaces/*/shaders/ - Workspace-specific only Changes: - Created common/shaders/ with math, render, compute subdirectories - Moved 20 common shaders from workspaces to common/ - Removed duplicates from test workspace - Updated assets.txt: ../../common/shaders/ references - Enhanced asset_packer.cc: filesystem path normalization for ../ resolution Implementation: Option 1 from SHADER_REUSE_INVESTIGATION.md - Single source of truth for common code - Workspace references via relative paths - Path normalization in asset packer handoff(Claude): Common shader directory implemented