diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-23 00:43:20 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-23 00:43:20 +0100 |
| commit | 13cf1438caa56b34529d4031ddf73d38286b70e5 (patch) | |
| tree | b8de1b0a597edcbfadcea5fca862be4b3d72a3db /cnn_v3/shaders/gbuf_deferred.wgsl | |
| parent | 1470dd240f48652d1fe97957fe44a49b0e1ee9a6 (diff) | |
feat(cnn_v3): shadow→dif migration complete (ch18)
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
Diffstat (limited to 'cnn_v3/shaders/gbuf_deferred.wgsl')
| -rw-r--r-- | cnn_v3/shaders/gbuf_deferred.wgsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cnn_v3/shaders/gbuf_deferred.wgsl b/cnn_v3/shaders/gbuf_deferred.wgsl index bcc42cc..7257122 100644 --- a/cnn_v3/shaders/gbuf_deferred.wgsl +++ b/cnn_v3/shaders/gbuf_deferred.wgsl @@ -40,9 +40,9 @@ fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f { let normal = oct_decode(vec2f(bx.y, ny_d.x)); let diffuse = max(0.0, dot(normal, KEY_LIGHT)); - // feat_tex1[3] = pack4x8unorm(dif.r, dif.g, dif.b, spare) — dif = diffuse*shadow + // feat_tex1[2] = pack4x8unorm(mip2.g, mip2.b, dif, transp) — dif at byte 2 let t1 = textureLoad(feat_tex1, coord, 0); - let dif = unpack4x8unorm(t1.w).x; + let dif = unpack4x8unorm(t1.z).z; return vec4f(albedo * (AMBIENT + dif), 1.0); } |
