diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-22 23:17:50 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-22 23:17:50 +0100 |
| commit | 8fd3eda0ed069b1a817261f8f4d6a35c565b3fe4 (patch) | |
| tree | ba7a61571d6e08d580ce0db9cddb9ad21584da75 /cnn_v3/src/gbuf_view_effect.cc | |
| parent | a2697faa005337c4d8e8e6376d9e57edadf63f44 (diff) | |
fix(cnn_v3): shadow pass — 5 bugs fixed, labels in gbuf_view
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.
Diffstat (limited to 'cnn_v3/src/gbuf_view_effect.cc')
| -rw-r--r-- | cnn_v3/src/gbuf_view_effect.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cnn_v3/src/gbuf_view_effect.cc b/cnn_v3/src/gbuf_view_effect.cc index 180919d..ccf80b0 100644 --- a/cnn_v3/src/gbuf_view_effect.cc +++ b/cnn_v3/src/gbuf_view_effect.cc @@ -10,6 +10,7 @@ #endif #include "gpu/gpu.h" +#include "gpu/shader_composer.h" #include "util/asset_manager.h" #include "util/fatal_error.h" @@ -63,7 +64,8 @@ GBufViewEffect::GBufViewEffect(const GpuContext& ctx, // Shader module WGPUShaderSourceWGSL wgsl_src = {}; wgsl_src.chain.sType = WGPUSType_ShaderSourceWGSL; - wgsl_src.code = str_view(gbuf_view_wgsl); + const std::string composed = ShaderComposer::Get().Compose({}, gbuf_view_wgsl); + wgsl_src.code = str_view(composed.c_str()); WGPUShaderModuleDescriptor shader_desc = {}; shader_desc.nextInChain = &wgsl_src.chain; WGPUShaderModule shader = |
