From 13cf1438caa56b34529d4031ddf73d38286b70e5 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 23 Mar 2026 00:43:20 +0100 Subject: feat(cnn_v3): shadow→dif migration complete (ch18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace raw shadow (ch18) with dif = max(0,dot(normal,KEY_LIGHT))*shadow across all layers. Channel count stays 20, weight shapes unchanged. - gbuf_pack.wgsl: t1.z = pack4x8unorm(mip2.g, mip2.b, dif, transp); t1.w = 0u - gbuf_deferred.wgsl: read dif from unpack4x8unorm(t1.z).z - gbuf_view.wgsl: revert to 4×5 grid, ch18=dif label, ch19=trns label - tools/shaders.js: FULL_PACK_SHADER adds oct_decode + computes dif - cnn_v3_utils.py: assemble_features() computes dif on-the-fly via oct_decode - docs: CNN_V3.md, HOWTO.md, HOW_TO_CNN.md, GBUF_DIF_MIGRATION.md updated handoff(Gemini): shadow→dif migration done, ready for first training pass --- cnn_v3/shaders/gbuf_pack.wgsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cnn_v3/shaders/gbuf_pack.wgsl') diff --git a/cnn_v3/shaders/gbuf_pack.wgsl b/cnn_v3/shaders/gbuf_pack.wgsl index dd8d73b..777b4e5 100644 --- a/cnn_v3/shaders/gbuf_pack.wgsl +++ b/cnn_v3/shaders/gbuf_pack.wgsl @@ -106,13 +106,13 @@ fn pack_features(@builtin(global_invocation_id) id: vec3u) { // Texture 1: 4 u32, each = pack4x8unorm of four u8 values // [0] mat_id | prev.r | prev.g | prev.b // [1] mip1.r | mip1.g | mip1.b | mip2.r - // [2] mip2.g | mip2.b | transp | (spare) - // [3] dif.r | dif.g | dif.b | (spare) — dif = diffuse*shadow (scalar, stored in all 3) + // [2] mip2.g | mip2.b | dif | transp — ch18=dif, ch19=transp + // [3] spare let t1 = vec4u( pack4x8unorm(vec4f(mat_id_u8, prev.r, prev.g, prev.b)), pack4x8unorm(vec4f(mip1.r, mip1.g, mip1.b, mip2.r)), - pack4x8unorm(vec4f(mip2.g, mip2.b, transp, 0.0)), - pack4x8unorm(vec4f(dif, dif, dif, 0.0)) + pack4x8unorm(vec4f(mip2.g, mip2.b, dif, transp)), + 0u ); textureStore(feat_tex1, coord, t1); } -- cgit v1.2.3