| Age | Commit message (Collapse) | Author |
|
|
|
- Missing WGPUFrontFace_CW (Y-flipped perspective) caused back faces to
render instead of front faces → cubes appeared inside-out.
- Sphere objects now use ray-sphere impostor in fs_main: correct silhouette,
smooth normal from hit point, and reprojected clip-space depth.
|
|
Raw WGSL was sent to WebGPU without resolving the math/normal include.
Also removed unused feat_tex1 binding (shadow dropped for now).
|
|
|
|
inv_model applies the inverse rotation → normals pointing inward.
model matrix is correct for uniform-scale objects (matches rotating_cube.wgsl).
|
|
New src/shaders/math/normal.wgsl: oct_encode, oct_decode, oct_encode_unorm,
oct_decode_unorm. Registered in InitShaderComposer as "math/normal".
Removed inline copies from gbuf_raster.wgsl and gbuf_pack.wgsl.
18/18 tests passing.
|
|
New effect unpacks feat_tex0/feat_tex1 and outputs albedo * shadow.
Replaces CNNv3Effect in cnn_v3_test sequence until training is complete.
37/37 tests passing.
handoff(Gemini): GBufDeferredEffect wired in timeline; CNN v3 pipeline: GBufferEffect → GBufDeferredEffect → sink.
|
|
dfWithID() in gbuf_shadow.wgsl now branches on obj.params.x
(ObjectType) instead of using sdBox for everything:
0=CUBE → sdBox(lp, vec3(1))
1=SPHERE → sdSphere(lp, 1.0)
2=PLANE → sdPlane(lp, vec3(0,1,0), obj.params.y)
3=TORUS → sdTorus(lp, vec2(0.8, 0.2))
36/36 tests pass.
|
|
Implements gbuf_shadow.wgsl: fullscreen render pass that reads depth
from Pass 1, reconstructs world-space positions, evaluates a proxy-box
SDF for each object (via inv_model), computes soft shadows for both
directional lights using shadowWithStoredDistance(), and writes shadow
factor to the RGBA8Unorm node_shadow_ target consumed by gbuf_pack.wgsl.
Bind layout: B0=GlobalUniforms, B1=ObjectsBuffer (storage-read),
B2=texture_depth_2d, B3=GBufLightsUniforms.
Sky fragments (depth=1.0) are output as 1.0 (fully lit).
Falls back to clear(1.0) if pipeline is not ready.
36/36 tests pass.
handoff(Gemini): Pass 2 done. Pass 3 (transparency) still TODO.
Phase 4 (type-aware SDF) optional after visual validation.
|
|
GBufferEffect:
- set_scene() now owns Scene/Camera internally; no external pointers needed
- 20 randomly rotating cubes (xorshift32 seed, axis-angle animation)
- 4 pumping spheres (radius = base_r * (1 + audio_intensity * 0.8))
- Camera at (0,2.5,6) looking at origin; aspect updated per-frame
- GBufLightsUniforms: 2 directional lights (warm key + cool fill)
- object_type written to ObjectData.params.x (ready for SDF shadow)
- shadow/transp nodes cleared via zero-draw render passes (placeholder)
- bilinear sampler cached via create_linear_sampler() / sampler_.get()
- dead placeholder textures removed
GBufViewEffect:
- gbuf_view.wgsl: all channels now fully grayscale (removed color tint)
- seq_compiler.py: GBufViewEffect added to CLASS_TO_HEADER
- timeline.seq: cnn_v3_test uses GBufViewEffect -> sink for debug view
Docs: HOWTO.md §1 updated with set_scene() description + §1b implementation
plan for Pass 2 SDF shadow (shader spec, bind layout, C++ additions)
handoff(Gemini): GBufferEffect has internal scene, 36/36 tests green.
Next: implement Pass 2 shadow (gbuf_shadow.wgsl) per §1b plan in HOWTO.md.
|
|
C++ GBufViewEffect: renders all 20 feature channels from feat_tex0/feat_tex1
in a 4×5 tiled grid. Custom BGL with WGPUTextureSampleType_Uint; bind group
rebuilt per frame via wgpuRenderPipelineGetBindGroupLayout.
Web tool: "Load sample directory" button — webkitdirectory picker, FULL_PACK_SHADER
compute (matches gbuf_pack.wgsl packing), runFromFeat() skips photo-pack step,
computePSNR() readback + comparison vs target.png side-by-side.
36/36 tests pass. Docs updated: HOWTO.md §9, README, PROJECT_CONTEXT, TODO,
COMPLETED.
handoff(Gemini): CNN v3 Phase 7 done. Next: run train_cnn_v3.py (see HOWTO §3).
|
|
C++:
- cnn_v3_effect.cc: fix declare_nodes comment (output node declared by caller)
- cnn_v3_effect.cc: add TODO(phase-7) marker for FiLM MLP replacement
WGSL:
- cnn_v3_bottleneck.wgsl: consolidate _pad fields onto one line, explain why
array<u32,3> is invalid in uniform address space
- cnn_v3_enc0.wgsl: fix "12xu8" → "12ch u8norm" in header comment
- cnn_v3_dec0.wgsl: clarify parity note (sigmoid after FiLM+ReLU, not raw conv)
- cnn_v3_common.wgsl: clarify unpack_8ch pack layout (low/high 16 bits)
Python:
- cnn_v3_utils.py: replace PIL-based _upsample_nearest (uint8 round-trip) with
pure numpy index arithmetic; rename _resize_rgb → _resize_img (handles any
channel count); add comment on normal zero-pad workaround
- export_cnn_v3_weights.py: add cross-ref to cnn_v3_effect.cc constants;
clarify weight count comments with Conv notation
Test:
- test_cnn_v3_parity.cc: enc0/dec1 layer failures now return 0 (were print-only)
handoff(Gemini): CNN v3 review complete, 36/36 tests passing.
|
|
5 compute shaders + cnn_v3/common snippet:
enc0: Conv(20→4,3×3) + FiLM + ReLU full-res
enc1: AvgPool + Conv(4→8,3×3) + FiLM + ReLU half-res
bottleneck: AvgPool + Conv(8→8,1×1) + ReLU quarter-res
dec1: NearestUp + cat(enc1) + Conv(16→4) + FiLM half-res
dec0: NearestUp + cat(enc0) + Conv(8→4) + FiLM + Sigmoid full-res
Parity rules: zero-pad conv, AvgPool down, NearestUp, FiLM after
conv+bias, skip=concat, OIHW weights+bias layout. Matches PyTorch
train_cnn_v3.py forward() exactly.
Registered in workspaces/main/assets.txt + src/effects/shaders.cc.
Weight layout + Params struct documented in cnn_v3/docs/HOWTO.md §7.
Next: Phase 4 — C++ CNNv3Effect + FiLM uniform upload.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
G-buffer (Phase 1):
- Add NodeTypes GBUF_ALBEDO/DEPTH32/R8/RGBA32UINT to NodeRegistry
- GBufferEffect: MRT raster pass (albedo+normal_mat+depth) + pack compute
- Shaders: gbuf_raster.wgsl (MRT), gbuf_pack.wgsl (feature packing, 32B/px)
- Shadow/SDF passes stubbed (placeholder textures), CMake integration deferred
Training infrastructure (Phase 2):
- blender_export.py: headless EXR export with all G-buffer render passes
- pack_blender_sample.py: EXR → per-channel PNGs (oct-normals, 1/z depth)
- pack_photo_sample.py: photo → zero-filled G-buffer sample layout
handoff(Gemini): G-buffer phases 3-5 remain (U-Net shaders, CNNv3Effect, parity)
|