| Age | Commit message (Collapse) | Author |
|
- gbuf_shadow.wgsl: normal bias 0.05→0.02
- gbuf_pack.wgsl: compute dif=diffuse*shadow, drop shadow from t1.z,
store dif in t1.w (INTERMEDIATE — incorrect packing, see migration plan)
- gbuf_deferred.wgsl: read dif from t1.w.x (matches intermediate packing)
- gbuf_view.wgsl: expand to 4×6 grid, show dif.r/g/b in row 5
(INTERMEDIATE — to be reverted to 4×5 with ch18=dif)
- gbuffer_effect.cc: add small hovering sphere (r=0.6) above scene;
swap cube/sphere positions; both spheres pulsate
- docs/GBUF_DIF_MIGRATION.md: full migration plan with checklist
handoff(Claude): intermediate commit — GBUF_DIF_MIGRATION.md §Current State
describes what is wrong and the full implementation checklist (5 steps).
|
|
gbuf_shadow.wgsl — dfWithID():
- Sphere: replace inv_model local-space transform with direct world-space
formula (length(p - center) - radius). Exact, no matrix multiply, no
floating-point error from matrix inversion that can corrupt soft-shadow
penumbra over 64 march steps.
- lp/scale now computed only inside the cases that need them (box/torus/plane)
instead of eagerly for every object.
gbuffer_effect.cc — upload_scene_data():
- Replace per-frame std::vector<GBufObjectData> heap allocation with a
file-static staging buffer s_obj_staging[256]: zero alloc per frame.
handoff(Gemini): sphere SDF now exact; shadow march should be cleaner.
|
|
1. Camera Y-inversion: proj.m[5] = -proj.m[5] in upload_scene_data
+ WGPUFrontFace_CCW on raster pipeline.
2. Shadow formula: replace shadowWithStoredDistance with 64-step
IQ soft shadow (8*d/t, unbounded).
3. Local→world SDF scale: d *= length(obj.model[0].xyz).
4. Shadow bias: use rasterized normal from normal_mat_tex (binding 4)
instead of light direction — fixes terminator self-shadow on spheres.
5. ShaderComposer: GBufViewEffect now resolves #include via
ShaderComposer::Get().Compose().
Also: per-tile channel labels in gbuf_view.wgsl via debug_str.
Scene simplified to 1 cube + 1 sphere for debugging (restore TODO).
Scale propagation for pulsating sphere confirmed correct end-to-end.
handoff(Gemini): shadow validated. Next: restore full scene in
GBufferEffect::set_scene() (20 cubes + 4 spheres, 2 lights), then
run training pass per cnn_v3/docs/HOWTO.md §3.
|
|
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.
|