diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-13 16:57:29 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-13 16:57:29 +0100 |
| commit | 0793c20c1dd0c5f0c535f7da90337081939b2cfc (patch) | |
| tree | 86f708033d93d19470e1b016e5abe52e07b340a8 /workspaces | |
| parent | 4c21145ce5e408dd38e8374eed320fcfac97c0c4 (diff) | |
CNN v2: Change feature #6 from sin(10*x) to sin(20*y)
Update positional encoding to use vertical coordinate at higher frequency.
Changes:
- train_cnn_v2.py: sin10_x → sin20_y (computed from uv_y)
- cnn_v2_static.wgsl: sin10_x → sin20_y (computed from uv_y)
- index.html: sin10_x → sin20_y (STATIC_SHADER)
- CNN_V2.md: Update feature descriptions and examples
- CNN_V2_BINARY_FORMAT.md: Update static features documentation
Feature vector: [p0, p1, p2, p3, uv_x, uv_y, sin20_y, bias]
Rationale: Higher frequency (20 vs 10) + vertical axis provides better
spatial discrimination for position encoding.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'workspaces')
| -rw-r--r-- | workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl index 29acddd..7039d96 100644 --- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl +++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl @@ -1,5 +1,5 @@ // CNN v2 Static Features Compute Shader -// Generates 8D parametric features: [p0, p1, p2, p3, uv.x, uv.y, sin10_x, bias] +// Generates 8D parametric features: [p0, p1, p2, p3, uv.x, uv.y, sin20_y, bias] // p0-p3: Parametric features from specified mip level (0=mip0, 1=mip1, 2=mip2, 3=mip3) // Note: Input image RGBD (mip0) fed separately to Layer 0 // @@ -51,18 +51,18 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) { let uv_y = 1.0 - (f32(coord.y) / f32(dims.y)); // Multi-frequency position encoding - let sin10_x = sin(10.0 * uv_x); + let sin20_y = sin(20.0 * uv_y); // Bias dimension (always 1.0) let bias = 1.0; // Pack 8×f16 into 4×u32 (rgba32uint) - // [p0, p1, p2, p3, uv_x, uv_y, sin10_x, bias] + // [p0, p1, p2, p3, uv_x, uv_y, sin20_y, bias] let packed = vec4<u32>( pack2x16float(vec2<f32>(p0, p1)), pack2x16float(vec2<f32>(p2, p3)), pack2x16float(vec2<f32>(uv_x, uv_y)), - pack2x16float(vec2<f32>(sin10_x, bias)) + pack2x16float(vec2<f32>(sin20_y, bias)) ); textureStore(output_tex, coord, packed); |
