diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 07:22:17 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 07:24:51 +0100 |
| commit | 0f53ed1ed8ed7c07cd7ea8e88e21b5be5d5494e5 (patch) | |
| tree | 0e1a8426c16e7c89b83038d5b90bb9d94c6d06e5 /workspaces/main | |
| parent | 8dd77545b5ec2f45ce46b98dd7d94a3c4a13e290 (diff) | |
CNN v2: bilinear mip-level sampling and UI improvements
**CNN v2 Changes:**
- Replace point sampling with bilinear interpolation for mip-level features
- Add linear sampler (binding 6) to static features shader
- Update CNNv2Effect, cnn_test, and HTML tool
**HTML Tool UI:**
- Move controls to floating bottom bar in central view
- Consolidate video controls + Blend/Depth/Save PNG in single container
- Increase left panel width: 300px → 315px (+5%)
- Remove per-frame debug messages (visualization, rendering logs)
**Technical:**
- WGSL: textureSample() with linear_sampler vs textureLoad()
- C++: Create WGPUSampler with Linear filtering
- HTML: Change sampler from 'nearest' to 'linear'
handoff(Claude): CNN v2 now uses bilinear mip-level sampling across all tools
Diffstat (limited to 'workspaces/main')
| -rw-r--r-- | workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl index 7b08132..63fafa8 100644 --- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl +++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl @@ -20,6 +20,7 @@ struct StaticFeatureParams { @group(0) @binding(3) var depth_tex: texture_2d<f32>; @group(0) @binding(4) var output_tex: texture_storage_2d<rgba32uint, write>; @group(0) @binding(5) var<uniform> params: StaticFeatureParams; +@group(0) @binding(6) var linear_sampler: sampler; @compute @workgroup_size(8, 8) fn main(@builtin(global_invocation_id) id: vec3<u32>) { @@ -30,17 +31,19 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) { return; } - // Parametric features (p0-p3) - sample from specified mip level + // Parametric features (p0-p3) - bilinear sample from specified mip level + // Use UV coordinates for bilinear interpolation + let uv = (vec2<f32>(coord) + 0.5) / vec2<f32>(dims); var rgba: vec4<f32>; if (params.mip_level == 0u) { - rgba = textureLoad(input_tex, coord, 0); + rgba = textureSample(input_tex, linear_sampler, uv); } else if (params.mip_level == 1u) { - rgba = textureLoad(input_tex_mip1, coord, 0); + rgba = textureSample(input_tex_mip1, linear_sampler, uv); } else if (params.mip_level == 2u) { - rgba = textureLoad(input_tex_mip2, coord, 0); + rgba = textureSample(input_tex_mip2, linear_sampler, uv); } else { // Mip 3 or higher: use mip 2 as fallback - rgba = textureLoad(input_tex_mip2, coord, 0); + rgba = textureSample(input_tex_mip2, linear_sampler, uv); } let p0 = rgba.r; |
