From 0793c20c1dd0c5f0c535f7da90337081939b2cfc Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 13 Feb 2026 16:57:29 +0100 Subject: CNN v2: Change feature #6 from sin(10*x) to sin(20*y) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- doc/CNN_V2.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/CNN_V2.md') diff --git a/doc/CNN_V2.md b/doc/CNN_V2.md index 2913498..78854ce 100644 --- a/doc/CNN_V2.md +++ b/doc/CNN_V2.md @@ -122,12 +122,12 @@ let uv_x = coord.x / resolution.x; // Horizontal position [0,1] let uv_y = coord.y / resolution.y; // Vertical position [0,1] // Slot 6: Multi-frequency position encoding -let sin10_x = sin(10.0 * uv_x); // Periodic feature (frequency=10) +let sin20_y = sin(20.0 * uv_y); // Periodic feature (frequency=20, vertical) // Slot 7: Bias dimension (always 1.0) let bias = 1.0; // Learned bias per output channel -// Packed storage: [p0, p1, p2, p3, uv.x, uv.y, sin(10*uv.x), 1.0] +// Packed storage: [p0, p1, p2, p3, uv.x, uv.y, sin(20*uv.y), 1.0] ``` ### Feature Rationale @@ -136,7 +136,7 @@ let bias = 1.0; // Learned bias per output channel |---------|-----------|---------|----------| | p0-p3 | 4D | Parametric auxiliary features (mips, gradients, etc.) | Essential | | UV coords | 2D | Spatial position awareness | Essential | -| sin(10\*uv.x) | 1D | Periodic position encoding | Medium | +| sin(20\*uv.y) | 1D | Periodic position encoding (vertical) | Medium | | Bias | 1D | Learned bias (standard NN) | Essential | **Note:** Input image RGBD (mip 0) fed only to Layer 0. Subsequent layers see static features + previous layer output. @@ -149,8 +149,8 @@ let bias = 1.0; // Learned bias per output channel ### Future Feature Extensions -**Option: Replace sin(10\*uv.x) with:** -- `sin(20*uv.x)` - Higher frequency encoding +**Option: Additional encodings:** +- `sin(40*uv.y)` - Higher frequency encoding - `gray_mip1` - Multi-scale luminance - `dx`, `dy` - Sobel gradients - `variance` - Local texture measure -- cgit v1.2.3