| Age | Commit message (Collapse) | Author |
|
Resolves critical shader composition and format mismatch issues, enabling the
circle mask + rotating cube demonstration at 2.0s-4.0s in the timeline.
**Key Fixes:**
1. **Shader Function Name** (masked_cube.wgsl):
- Fixed call to `ray_box_intersection()` (was incorrectly `ray_box()`)
- Updated return value handling to use `RayBounds` struct (`.hit`, `.t_entry`, `.t_exit`)
- Removed unused `sky_tex` binding to match pipeline layout expectations (5 bindings → 4)
2. **Shader Lifetime Issue** (rotating_cube_effect.h/cc):
- Added `std::string composed_shader_` member to persist shader source
- Prevents use-after-free when WebGPU asynchronously parses shader code
3. **Format Mismatch** (circle_mask_effect.cc):
- Changed compute pipeline format from hardcoded `RGBA8Unorm` to `ctx_.format` (Bgra8UnormSrgb)
- Matches auxiliary texture format created by `MainSequence::register_auxiliary_texture()`
- Added depth stencil state to render pipeline to match scene pass requirements:
* Format: Depth24Plus
* depthWriteEnabled: False (no depth writes needed)
* depthCompare: Always (always pass depth test)
4. **WebGPU Descriptor Initialization** (circle_mask_effect.cc):
- Added `depthSlice = WGPU_DEPTH_SLICE_UNDEFINED` for non-Windows builds
- Ensures proper initialization of render pass color attachments
5. **Test Coverage** (test_demo_effects.cc):
- Updated EXPECTED_SCENE_COUNT: 6 → 8 (added CircleMaskEffect, RotatingCubeEffect)
- Marked both effects as requiring 3D pipeline setup (skipped in basic tests)
**Technical Details:**
- **Auxiliary Texture Flow**: CircleMaskEffect generates mask (1.0 inside, 0.0 outside) →
RotatingCubeEffect samples mask to render only inside circle → GaussianBlurEffect post-processes
- **Pipeline Format Matching**: All pipelines targeting same render pass must use matching formats:
* Color: Bgra8UnormSrgb (system framebuffer format)
* Depth: Depth24Plus (scene pass depth buffer)
- **ShaderComposer Integration**: Relies on `InitShaderComposer()` (called in `gpu.cc:372`)
registering snippets: `common_uniforms`, `math/sdf_utils`, `ray_box`, etc.
**Effect Behavior:**
- Runs from 2.0s to 4.0s in demo timeline
- CircleMaskEffect (priority 0): Draws green outside circle, transparent inside
- RotatingCubeEffect (priority 1): Renders bump-mapped cube inside circle
- GaussianBlurEffect (priority 2): Post-process blur on entire composition
**Test Results:**
- All 33 tests pass (100%)
- No WebGPU validation errors
- Demo runs cleanly with `--seek 2.0`
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
- 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.
|
|
Implements comprehensive RNG and noise functions for procedural
shader effects:
Hash Functions:
- hash_1f, hash_2f, hash_3f (float-based, fast)
- hash_2f_2f, hash_3f_3f (vector output)
- hash_1u, hash_1u_2f, hash_1u_3f (integer-based, high quality)
Noise Functions:
- noise_2d, noise_3d (value noise with smoothstep)
- fbm_2d, fbm_3d (fractional Brownian motion)
- gyroid (periodic minimal surface)
Integration:
- Added to ShaderComposer as "math/noise" snippet
- Available via #include "math/noise" in WGSL shaders
- Test suite validates all 11 functions compile
Testing:
- test_noise_functions.cc validates shader loading
- All 33 tests pass (100%)
Size Impact: ~200-400 bytes per function used (dead-code eliminated)
Files:
- assets/final/shaders/math/noise.wgsl (new, 4.2KB, 150 lines)
- assets/final/demo_assets.txt (added SHADER_MATH_NOISE)
- assets/final/test_assets_list.txt (added SHADER_MATH_NOISE)
- src/gpu/effects/shaders.cc (registered snippet)
- src/tests/test_noise_functions.cc (new test)
- CMakeLists.txt (added test target)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
Implements ray-triangle intersection algorithm for future mesh raytracing support.
Changes:
- Add ray_triangle.wgsl with TriangleHit struct and intersection function
- Register shader snippet in asset system (SHADER_RAY_TRIANGLE)
- Add shader composer registration for #include "ray_triangle" support
Returns:
- hit.uv: Barycentric coordinates (for texture mapping)
- hit.z: Parametric distance along ray
- hit.N: Triangle face normal
- hit.hit: Boolean indicating intersection
Task: Progress on SDF for mesh (related to Task #18)
Algorithm: Fast, Minimum Storage Ray-Triangle Intersection (Möller-Trumbore)
Size: ~30 lines WGSL, negligible binary impact
|
|
Updated renderer_3d.wgsl, mesh_render.wgsl, skybox.wgsl to use
common_utils functions. Registered snippet in ShaderComposer.
Updated demo_assets.txt with SHADER_MATH_COMMON_UTILS entry.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
ROOT CAUSE:
- 15 stale .spec files from pre-orthonormal DCT era (16x amplification)
- Asset manifest referenced 3 non-existent samples (kick1, snare1, hihat1)
- music.track used outdated asset IDs after renumbering
FIXES:
1. Removed all 29 stale .spec files
2. Regenerated 14 clean spectrograms from source files
3. Updated demo_assets.txt: removed KICK_1, SNARE_1, HIHAT_1; renumbered remaining
4. Updated music.track: KICK_3→KICK_2, SNARE_4→SNARE_3, HIHAT_4→HIHAT_3
5. Added BASS_2 (BASS_SYNTH_1.spec) to asset manifest
VERIFICATION:
- All peak levels < 1.0 (no clipping) ✅
- Demo builds and runs successfully ✅
REMAINING ISSUE:
- RMS levels vary 4.6x (0.054 to 0.248)
- Samples not normalized before encoding
- This explains erratic volume in demo64k
- Recommend: normalize source .wav files before spectool analyze
handoff(Claude): Audio distortion fixed, but samples need RMS normalization.
|
|
Added dodecahedron.obj (downloaded from external source) to demo assets.
Updated test_3d_render to display the dodecahedron mesh alongside the cube mesh.
Verified asset packing and rendering pipeline.
|
|
Added support for loading and rendering OBJ meshes.
- Updated asset_packer to parse .obj files into a binary format.
- Added MeshAsset and GetMeshAsset helper to asset_manager.
- Extended Object3D with mesh_asset_id and ObjectType::MESH.
- Implemented mesh rasterization pipeline in Renderer3D.
- Added a sample cube mesh and verified in test_3d_render.
|
|
Completed Task #18-B optimization and refactoring.
- Replaced runtime branching in shader with compile-time snippet substitution in ShaderComposer.
- Added 'scene_query_bvh.wgsl' and 'scene_query_linear.wgsl' as distinct snippets.
- Refactored Renderer3D to manage two separate pipelines (with and without BVH).
- Updated ShaderComposer to support snippet substitution during composition.
- Verified both paths with test_3d_render (default and --no-bvh).
- Removed temporary shader hacks and cleaned up renderer_3d.wgsl.
|
|
#50)
- Updated ShaderComposer to support recursive #include "snippet_name" with cycle detection.
- Extracted granular WGSL snippets: math/sdf_shapes, math/sdf_utils, render/shadows, render/scene_query, render/lighting_utils.
- Refactored Renderer3D to use #include in shaders, simplifying C++ dependency lists.
- Fixed WGPUShaderSourceWGSL usage on macOS to correctly handle composed shader strings.
- Added comprehensive unit tests for recursive composition in test_shader_composer.
- Verified system stability with test_3d_render and full test suite.
- Marked Task #50 as recurrent for future code hygiene.
|
|
- Added ObjectType::SKYBOX for dedicated skybox rendering.
- Created assets/final/shaders/skybox.wgsl for background rendering.
- Implemented a two-pass rendering strategy in Renderer3D::render:
- First pass renders the skybox without depth writes.
- Second pass renders scene objects with depth testing.
- Corrected GlobalUniforms struct in common_uniforms.wgsl and src/3d/renderer.h to include and explicit padding for 112-byte alignment.
- Updated Renderer3D::update_uniforms to set the new and zero-initialize padding.
- Reverted sky sampling logic in renderer_3d.wgsl to for SDF misses, preventing background bleed-through.
- Updated test_3d_render.cc to include a SKYBOX object with Perlin noise.
handoff(Gemini): The skybox is now correctly rendered with Perlin noise as a dedicated background pass. Objects render correctly without transparency to the sky. All necessary C++ and WGSL shader changes are implemented and verified.
|
|
Created a new script, scripts/gen_spectrograms.sh, to robustly convert all audio files in assets/originals to .spec format. The new script is more portable and provides better feedback. Added the newly generated drum and bass samples to the asset list, organizing them by type for clarity. This completes the requested sub-task.
|
|
Extracted all hardcoded WGSL shaders into external assets. Updated AssetManager to handle shader snippets. Refactored Renderer3D, VisualDebug, and Effects to load shaders via the AssetManager, enabling better shader management and composition.
|
|
- Added depth buffer support to MainSequence.
- Implemented Hybrid3DEffect for the main timeline.
- Fixed effect initialization order in MainSequence.
- Ensured depth-stencil compatibility for all scene effects.
- Updated demo sequence with 3D elements and post-processing.
|
|
- Updated asset_packer to parse PROC(...) syntax with robust regex.
- Implemented runtime dispatch in AssetManager for procedural generation.
- Added procedural generator functions (noise, grid, periodic).
- Added comprehensive tests for procedural asset lifecycle.
|
|
Removed dummy and test assets from the main demo list, leaving only the required drum samples.
|
|
Renamed demo assets to 'demo_assets.txt' and created 'test_assets_list.txt' for AssetManagerTest to prevent interference.
- Updated CMakeLists.txt to generate separate headers for demo and test.
- Updated test_assets.cc to conditionally include the test-specific header.
- Incorporated gen_assets.sh into the 'final' target.
|