<feed xmlns='http://www.w3.org/2005/Atom'>
<title>demo.git/assets/final/shaders/render, branch main</title>
<subtitle>Vide-coded 64k demo system</subtitle>
<id>https://git.taar-o.com/demo.git/atom?h=main</id>
<link rel='self' href='https://git.taar-o.com/demo.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/'/>
<updated>2026-02-13T07:21:34Z</updated>
<entry>
<title>Refactor: Reorganize workspaces and remove assets/ directory</title>
<updated>2026-02-13T07:21:34Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T07:21:34Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=eb15703a3f87e4eadc8839b06de12b9c6ec54023'/>
<id>urn:sha1:eb15703a3f87e4eadc8839b06de12b9c6ec54023</id>
<content type='text'>
Workspace structure now:
- workspaces/{main,test}/obj/      (3D models)
- workspaces/{main,test}/shaders/  (WGSL shaders)
- workspaces/{main,test}/music/    (audio samples)

Changes:
- Moved workspaces/*/assets/music/ → workspaces/*/music/
- Updated assets.txt paths (assets/music/ → music/)
- Moved test_demo.{seq,track} to tools/
- Moved assets/originals/ → tools/originals/
- Removed assets/common/ (legacy, duplicated in workspaces)
- Removed assets/final/ (legacy, superseded by workspaces)
- Updated hot-reload paths in main.cc
- Updated CMake references for test_demo and validation
- Updated gen_spectrograms.sh paths

handoff(Claude): Workspace reorganization complete
</content>
</entry>
<entry>
<title>feat(3d): Fix ObjectType::PLANE scaling and consolidate ObjectType mapping</title>
<updated>2026-02-08T06:38:28Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-08T06:38:28Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=b8e6929cafa41681f0b27ac104c9cf1d4e510837'/>
<id>urn:sha1:b8e6929cafa41681f0b27ac104c9cf1d4e510837</id>
<content type='text'>
- Implemented correct scaling for planes in both CPU (physics) and GPU (shaders) using the normal-axis scale factor.
- Consolidated ObjectType to type_id mapping in Renderer3D to ensure consistency and support for CUBE.
- Fixed overestimation of distance for non-uniformly scaled ground planes, which caused missing shadows.
- Updated documentation and marked Task A.2 as completed.
</content>
</entry>
<entry>
<title>fix(shaders): Resolve WGSL validation errors and add shader compilation tests</title>
<updated>2026-02-06T13:08:09Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T13:08:09Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=1e3e3f54a4f80bd05d168c9ae749ed32e1275868'/>
<id>urn:sha1:1e3e3f54a4f80bd05d168c9ae749ed32e1275868</id>
<content type='text'>
Fixed three critical WGSL shader issues causing demo64k and test_3d_render to crash:

1. **renderer_3d.wgsl**: Removed dead code using non-existent `inverse()` function
   - WGSL doesn't have `inverse()` for matrices
   - Dead code was unreachable but still validated by shader compiler
   - Also removed reference to undefined `in.normal` vertex input

2. **sdf_utils.wgsl &amp; lighting.wgsl**: Fixed `get_normal_basic()` signature mismatch
   - Changed parameter from `obj_type: f32` to `obj_params: vec4&lt;f32&gt;`
   - Now correctly matches `get_dist()` function signature

3. **scene_query_linear.wgsl**: Fixed incorrect BVH binding declaration
   - Linear mode was incorrectly declaring binding 2 (BVH buffer)
   - Replaced BVH traversal with simple linear object loop
   - Root cause: Both BVH and Linear shaders were identical (copy-paste error)

Added comprehensive shader compilation test (test_shader_compilation.cc):
- Tests all production shaders compile successfully through WebGPU
- Validates both BVH and Linear composition modes
- Catches WGSL syntax errors, binding mismatches, and type errors
- Would have caught all three bugs fixed in this commit

Why tests didn't catch this:
- Existing test_shader_assets only checked for keywords, not compilation
- No test actually created WebGPU shader modules from composed code
- New test fills this gap with real GPU validation

Results:
- demo64k runs without WebGPU errors
- test_3d_render no longer crashes
- All 22/23 tests pass (FftTest unrelated issue from FFT Phase 1)

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Revert "fix(shaders): Correct plane distance scaling for non-uniform transforms"</title>
<updated>2026-02-06T08:56:26Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T08:56:26Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=2b4ce2eed8fc4333b2c623836e7969b66b7be6e4'/>
<id>urn:sha1:2b4ce2eed8fc4333b2c623836e7969b66b7be6e4</id>
<content type='text'>
This reverts commit a5229022b0e500ac86560e585081f45293e587d2.
</content>
</entry>
<entry>
<title>fix(shaders): Correct plane distance scaling for non-uniform transforms</title>
<updated>2026-02-06T08:53:52Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T08:53:52Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=a5229022b0e500ac86560e585081f45293e587d2'/>
<id>urn:sha1:a5229022b0e500ac86560e585081f45293e587d2</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>fix(shaders): Exclude meshes from SDF scaling factor in shadow calculations</title>
<updated>2026-02-06T08:46:10Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T08:46:10Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=f573e9e12855f9a90878c57d1083985dc29d75b5'/>
<id>urn:sha1:f573e9e12855f9a90878c57d1083985dc29d75b5</id>
<content type='text'>
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 &amp;&amp; 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).
</content>
</entry>
<entry>
<title>fix: Correct mesh normal transformation and floor shadow rendering</title>
<updated>2026-02-06T07:46:20Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T07:46:20Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=7d60a8a9ece368e365b5c857600004298cb89526'/>
<id>urn:sha1:7d60a8a9ece368e365b5c857600004298cb89526</id>
<content type='text'>
</content>
</entry>
<entry>
<title>chore: Update documentation, generated assets, and cleanup</title>
<updated>2026-02-06T01:16:32Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T01:16:32Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=32a6d4f516b2ff45e25ddc7870e5400c2973fb9a'/>
<id>urn:sha1:32a6d4f516b2ff45e25ddc7870e5400c2973fb9a</id>
<content type='text'>
Removed obsolete scene_query.wgsl (replaced by variants). Updated TODO.md. Committed generated asset files reflecting new shader snippets.
</content>
</entry>
<entry>
<title>refactor(gpu): Implement compile-time BVH toggle via shader composition</title>
<updated>2026-02-06T01:14:30Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T01:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=75bdd2f8c17169422d175ed2d9dfceb9acb0fe77'/>
<id>urn:sha1:75bdd2f8c17169422d175ed2d9dfceb9acb0fe77</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>feat(perf): Add toggle for GPU BVH and fix fallback</title>
<updated>2026-02-06T00:38:51Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-06T00:38:51Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=ae4b03ef6f5ef07dcc80affd6877d17fceee7d29'/>
<id>urn:sha1:ae4b03ef6f5ef07dcc80affd6877d17fceee7d29</id>
<content type='text'>
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.
</content>
</entry>
</feed>
