summaryrefslogtreecommitdiff
path: root/cnn_v3/src/gbuffer_effect.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-22 19:29:01 +0100
committerskal <pascal.massimino@gmail.com>2026-03-22 19:29:01 +0100
commit7b89a7130a998017de98dde363a8d9be61d7d44e (patch)
tree2b45a3253a5770170d787915b5c3d18fd69e40ac /cnn_v3/src/gbuffer_effect.h
parentc5e66964c0463219019d0439ec20b79248637fa4 (diff)
feat(cnn_v3): GBufferEffect Pass 2 — SDF shadow raymarching
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.
Diffstat (limited to 'cnn_v3/src/gbuffer_effect.h')
-rw-r--r--cnn_v3/src/gbuffer_effect.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cnn_v3/src/gbuffer_effect.h b/cnn_v3/src/gbuffer_effect.h
index d45be75..c39219b 100644
--- a/cnn_v3/src/gbuffer_effect.h
+++ b/cnn_v3/src/gbuffer_effect.h
@@ -83,6 +83,9 @@ class GBufferEffect : public Effect {
RenderPipeline raster_pipeline_;
BindGroup raster_bind_group_;
+ // Pass 2: SDF shadow pipeline
+ RenderPipeline shadow_pipeline_;
+
// Pass 4: Pack compute pipeline
ComputePipeline pack_pipeline_;
BindGroup pack_bind_group_;
@@ -95,6 +98,7 @@ class GBufferEffect : public Effect {
int objects_buf_capacity_ = 0;
void create_raster_pipeline();
+ void create_shadow_pipeline();
void create_pack_pipeline();
void update_raster_bind_group(NodeRegistry& nodes);