summaryrefslogtreecommitdiff
path: root/assets/final
AgeCommit message (Collapse)Author
10 hoursRevert "fix(shaders): Correct plane distance scaling for non-uniform transforms"skal
This reverts commit a5229022b0e500ac86560e585081f45293e587d2.
10 hoursfix(shaders): Correct plane distance scaling for non-uniform transformsskal
When a plane has non-uniform scaling (e.g., floor with scale 20,0.01,20), transforming points to local space distorts SDF distances. For a horizontal plane with Y-scale of 0.01, distances become 100x too large in local space. Fix: Multiply plane distances by the scale factor along the normal direction (Y component for horizontal planes). This corrects shadow calculations while maintaining the large floor area needed for visualization. Reverted incorrect uniform scale fix (c23f3b9) that made floor too small.
10 hoursfix(shaders): Exclude meshes from SDF scaling factor in shadow calculationsskal
Fixed incorrect mesh shadow rendering caused by applying scale factor to mesh AABBs which already have correct local-space extents. ROOT CAUSE: The 's' scale factor (line 44) is meant for UNIT primitives (sphere, box, torus) that are scaled by the model matrix. Meshes (type 5.0) already store their correct AABB extents in obj_params.yzw, so applying 's' caused incorrect shadow sizes. ISSUE: let s = min(length(obj.model[0].xyz), ...); if (obj.params.x != 4.0) { // Excluded planes only d = min(d, get_dist(q, obj.params) * s); // ❌ WRONG for meshes! } FIX: if (obj.params.x != 4.0 && obj.params.x != 5.0) { // Exclude planes AND meshes d = min(d, get_dist(q, obj.params) * s); } else { d = min(d, get_dist(q, obj.params)); // No scaling } EXPLANATION: - Type 1.0 (Sphere): Unit sphere, scaled by 's' ✓ - Type 2.0 (Box): Unit box, scaled by 's' ✓ - Type 3.0 (Torus): Unit torus, scaled by 's' ✓ - Type 4.0 (Plane): Special case, no scaling ✓ - Type 5.0 (Mesh): AABB already has correct size, no scaling needed ✓ FILES FIXED: - assets/final/shaders/render/scene_query_linear.wgsl - assets/final/shaders/render/scene_query_bvh.wgsl PARTIAL FIX: This fixes mesh shadow sizing issues. Shadow rotation limitation remains (AABBs are axis-aligned, don't rotate with mesh - this is a fundamental AABB limitation, not a bug). handoff(Claude): Mesh shadows now correctly sized. Investigating floor shadow stretching issue next (likely related to plane scaling).
11 hoursfix(shaders): Correct mesh normal transformation - remove double transposeskal
Fixed critical bug in normal matrix transformation causing mesh stretching and incorrect scaling during rotation. ROOT CAUSE: In WGSL, mat3x3(v0, v1, v2) creates a matrix where v0, v1, v2 are COLUMNS. When extracting rows from inv_model, the constructor already produces the transpose. Applying transpose() again cancels out, giving incorrect normals. ISSUE: let normal_matrix = mat3x3(inv_model[0].xyz, inv_model[1].xyz, inv_model[2].xyz); // This gives transpose(inv_model) already! out.normal = normalize(transpose(normal_matrix) * in.normal); // Double transpose = identity, wrong result FIX: let normal_matrix = mat3x3(inv_model[0].xyz, inv_model[1].xyz, inv_model[2].xyz); // Already transpose(inv_model), which is the correct normal matrix out.normal = normalize(normal_matrix * in.normal); // Correct transformation FILES FIXED: - assets/final/shaders/mesh_render.wgsl:38 (mesh vertex normals) - assets/final/shaders/renderer_3d.wgsl:185 (SDF bump-mapped normals) RESULT: Mesh normals now transform correctly under rotation and non-uniform scaling. Fixes Task A (test_mesh visualization stretching bug). handoff(Claude): Normal transformation bug fixed. Mesh should now render correctly without stretching. Shadow bug on floor plane still remains (separate WGSL shader issue for later investigation).
11 hoursfix: Correct mesh normal transformation and floor shadow renderingskal
13 hoursfeat(assets): Add dodecahedron mesh assetskal
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.
13 hoursfeat(3d): Implement basic OBJ mesh asset pipelineskal
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.
18 hourschore: Update documentation, generated assets, and cleanupskal
Removed obsolete scene_query.wgsl (replaced by variants). Updated TODO.md. Committed generated asset files reflecting new shader snippets.
18 hoursrefactor(gpu): Implement compile-time BVH toggle via shader compositionskal
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.
19 hoursfeat(perf): Add toggle for GPU BVH and fix fallbackskal
Completed Task #18-B. - Implemented GPU-side BVH traversal for scene queries, improving performance. - Added a --no-bvh command-line flag to disable the feature for debugging and performance comparison. - Fixed a shader compilation issue where the non-BVH fallback path failed to render objects.
26 hourstest(assets): Add tests for Texture Asset supportskal
- Added test_image.tga (generated via tools/gen_test_tga.cc). - Updated test_assets_list.txt to include the TGA. - Updated test_assets.cc to verify image decompression and pixel values.
46 hoursfeat: Optional sequence end times and comprehensive effect documentationskal
This milestone implements several key enhancements to the sequencing system and developer documentation: ## Optional Sequence End Times (New Feature) - Added support for explicit sequence termination via [time] syntax - Example: SEQUENCE 0 0 [30.0] forcefully ends all effects at 30 seconds - Updated seq_compiler.cc to parse optional [time] parameter with brackets - Added end_time_ field to Sequence class (default -1.0 = no explicit end) - Modified update_active_list() to check sequence end time and deactivate all effects when reached - Fully backward compatible - existing sequences work unchanged ## Comprehensive Effect Documentation (demo.seq) - Documented all effect constructor parameters (standard: device, queue, format) - Added runtime parameter documentation (time, beat, intensity, aspect_ratio) - Created detailed effect catalog with specific behaviors: * Scene effects: HeptagonEffect, ParticlesEffect, Hybrid3DEffect, FlashCubeEffect * Post-process effects: GaussianBlurEffect, SolarizeEffect, ChromaAberrationEffect, ThemeModulationEffect, FadeEffect, FlashEffect - Added examples section showing common usage patterns - Documented exact parameter behaviors (e.g., blur pulsates 0.5x-2.5x, flash triggers at intensity > 0.7, theme cycles every 8 seconds) ## Code Quality & Verification - Audited all hardcoded 1280x720 dimensions throughout codebase - Verified all shaders use uniforms.resolution and uniforms.aspect_ratio - Confirmed Effect::resize() properly updates width_/height_ members - No issues found - dimension handling is fully dynamic and robust ## Files Changed - tools/seq_compiler.cc: Parse [end_time], generate set_end_time() calls - src/gpu/effect.h: Added end_time_, set_end_time(), get_end_time() - src/gpu/effect.cc: Check sequence end time in update_active_list() - assets/demo.seq: Comprehensive syntax and effect documentation - Generated files updated (timeline.cc, assets_data.cc, music_data.cc) This work establishes a more flexible sequencing system and provides developers with clear documentation for authoring demo timelines. handoff(Claude): Optional sequence end times implemented, effect documentation complete, dimension handling verified. Ready for next phase of development.
2 daysfeat(gpu): Implement recursive WGSL composition and modularize shaders (Task ↵skal
#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.
2 daystest(coverage): Improve Asset Manager coverage (Task #47)skal
Added tests for runtime error handling in Asset Manager (unknown function, generation failure). Updated asset_packer to warn instead of fail on unknown functions to facilitate testing. Increased coverage from 71% to 88%.
2 dayshandoff(Claude): Stabilize 3D renderer with rotating skybox and two-pass ↵skal
architecture - Fixed black screen by ensuring clear operations in Pass 2 when Skybox pass is skipped. - Resolved WebGPU validation errors by synchronizing depth-stencil state. - Implemented rotating skybox using world-space ray unprojection (inv_view_proj). - Improved procedural noise generation (multi-octave Value Noise). - Restored scene integrity by correcting object indexing and removing artifacts. - Updated documentation (TODO.md, PROJECT_CONTEXT.md).
3 daysfix: Implement proper skybox rendering with Perlin noiseskal
- 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.
3 daysfeat: side-quest - Perlin noise sky and ProcGenFunc error handlingskal
- Updated ProcGenFunc signature to return bool for error reporting. - Implemented gen_perlin (Fractional Brownian Motion) in procedural/generator.cc. - Added support for sky texture in Renderer3D and its shader. - Integrated Perlin noise sky texture in test_3d_render.cc. - Caught and handled memory/generation errors in AssetManager and TextureManager. - Assigned reference numbers to all remaining tasks in documentation. handoff(Gemini): Side-quest complete. ProcGenFunc now returns bool. Perlin noise added and used for sky in 3D test. Windows build remains stable. All tasks numbered.
3 daystest(shader): Add ShaderComposer and WGSL asset validation tests (Task #26)skal
Implemented comprehensive unit tests for ShaderComposer and a validation test for production WGSL shader assets. This ensures the shader asset pipeline is robust and that all shaders contain required entry points and snippets. Also improved InitShaderComposer to be more robust during testing.
3 daysfeat(assets): Add new drum samples and improve conversion scriptskal
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.
3 dayschore: Finalize Build System Consolidation (Task #25)skal
Updated project roadmap and to-do list to reflect the completion of the modular build system refactor.
3 daysrefactor: Shader Asset Integration (Task #24)skal
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.
5 daysfeat(gpu): Integrate bumpy 3D renderer into main demoskal
- 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.
5 daysfeat(assets): Implement procedural asset generation pipelineskal
- 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.
5 daysfeat(assets): Implement procedural asset generation pipelineskal
- Updated asset_packer to parse PROC(...) syntax. - Implemented runtime dispatch in AssetManager for procedural generation. - Added procedural generator functions (noise, grid, periodic). - Added comprehensive tests for procedural asset lifecycle.
6 daysadd spec assetsskal
9 dayschore(assets): Clean up demo_assets.txtskal
Removed dummy and test assets from the main demo list, leaving only the required drum samples.
9 dayschore(assets): Remove obsolete assets.txtskal
This file has been replaced by 'demo_assets.txt' and 'test_assets_list.txt'.
9 daysfeat(assets): Separate demo and test asset listsskal
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.
9 daysfeat(demo): Add drum sequence using embedded assetsskal
Incorporates kick1.spec, snare1.spec, and hihat1.spec into the demo sequence. - Updated assets.txt with new drum identifiers. - Implemented register_spec_asset helper in main.cc to load spectral data. - Added 8th-note sequencer triggering a simple drum and bass pattern.
9 daystest(assets): Add functional tests for asset management systemskal
This commit makes the asset packer fully functional and adds an end-to-end test suite. - Updated asset_packer.cc to read file contents and embed them as hex arrays. - Added actual asset files (null.bin, test_asset.txt) for testing. - Implemented src/tests/test_assets.cc to verify data integrity at runtime. - Refactored CMakeLists.txt to handle generated file dependencies correctly.
9 daysfeat(assets): Implement basic asset packing systemskal
Introduces a new asset management system to embed binary assets directly into the demo executable. - Creates the directory for asset definition and an descriptor file. - Implements to generate (with enum and declaration) and (with placeholder data). - Integrates into CMake build, making depend on the generated asset files. - Adds minimal integration in and documentation in . This addresses Task 9 (compact in-line and off-line asset system).