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 --- workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl') 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) { 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( pack2x16float(vec2(p0, p1)), pack2x16float(vec2(p2, p3)), pack2x16float(vec2(uv_x, uv_y)), - pack2x16float(vec2(sin10_x, bias)) + pack2x16float(vec2(sin20_y, bias)) ); textureStore(output_tex, coord, packed); -- cgit v1.2.3