From b09a50efbf2478167f9dbbd4d348baf82ad8633f Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 6 Jul 2026 14:59:32 +0200 Subject: [PATCH] fix(tooling): depth-only epsilon bias for the clip discriminator + corrected findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pass-B garment shift is now a depth-only bias in the vertex shader (no screen-space parallax), eliminating silhouette-growth false positives. This supersedes the previous commit's mid-run numbers: final peasant run is 33/72 clip flags, ALL genuine tight-proximity findings — 0/18 on front views (discriminator proof), sleeveless armhole seams on average_f (side), deep-crouch waist gap (back, worst 150px), collar nape. Bare-arm-crossing- torso cases correctly reclassed exposed_skin (non-gating). Sensitivity knobs: clip_epsilon_m (3cm) + --min-pixels (8), tuned to surface tight seams; calibrate against the first real modern garments. Co-Authored-By: Claude Fable 5 --- client/tools/garment_qa/chromakey_scene.gd | 21 +++++++++++++++------ tooling/garment-qa/configs/peasant.json | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/client/tools/garment_qa/chromakey_scene.gd b/client/tools/garment_qa/chromakey_scene.gd index 37ebc1fd7..084071069 100644 --- a/client/tools/garment_qa/chromakey_scene.gd +++ b/client/tools/garment_qa/chromakey_scene.gd @@ -118,10 +118,15 @@ func _make_key_material() -> ShaderMaterial: return mat -## Flat unshaded cyan whose vertices are nudged `shift` metres toward the camera in -## view space (pass B). Cull is left default so only camera-facing cloth counts as the -## near layer — a far back panel shifted epsilon closer is still far and won't cover the -## body-key. Works on skinned garments: VERTEX arrives already skinned in model space. +## Flat unshaded cyan garment with a DEPTH-ONLY bias of `shift` metres toward the camera +## (pass B). The screen x/y is kept exactly (clip_orig.xy) while the NDC depth is taken +## from the epsilon-nearer vertex — so the garment renders at its true silhouette but +## depth-tests as if `shift` closer. This biases depth WITHOUT the ~1.25% silhouette +## magnification a plain view-space translation would cause, so skin merely BESIDE a +## cloth edge is not falsely covered — only skin the garment actually projects over +## (i.e. cloth truly behind it) and within epsilon flips to cyan. Cull is left default +## so a far back panel (shifted epsilon closer, still far) won't cover the body-key. +## Works on skinned garments: VERTEX arrives already skinned in model space. func _make_shift_material(epsilon: float) -> ShaderMaterial: var shader := Shader.new() shader.code = ( @@ -130,8 +135,12 @@ func _make_shift_material(epsilon: float) -> ShaderMaterial: + "uniform float shift = 0.03;\n" + "void vertex() {\n" + "\tvec4 view_pos = MODELVIEW_MATRIX * vec4(VERTEX, 1.0);\n" - + "\tview_pos.z += shift;\n" # camera looks down -Z; +Z is toward the camera - + "\tPOSITION = PROJECTION_MATRIX * view_pos;\n" + + "\tvec4 clip_orig = PROJECTION_MATRIX * view_pos;\n" + + "\tvec4 view_near = view_pos;\n" + + "\tview_near.z += shift;\n" # camera looks down -Z; +Z is toward the camera + + "\tvec4 clip_near = PROJECTION_MATRIX * view_near;\n" + + "\tfloat ndc_z_near = clip_near.z / clip_near.w;\n" + + "\tPOSITION = vec4(clip_orig.x, clip_orig.y, ndc_z_near * clip_orig.w, clip_orig.w);\n" + "}\n" + "void fragment() {\n" + "\tALBEDO = vec3(0.0, 1.0, 1.0);\n" diff --git a/tooling/garment-qa/configs/peasant.json b/tooling/garment-qa/configs/peasant.json index e8af2a240..4fc4f8705 100644 --- a/tooling/garment-qa/configs/peasant.json +++ b/tooling/garment-qa/configs/peasant.json @@ -7,6 +7,7 @@ "clips": ["Walk", "Sprint", "Crouch_Fwd"], "frames_per_clip": 3, "yaws": [0, 90, 180, 270], + "clip_epsilon_m": 0.03, "head_id": "head_001", "hair_id": "buzzed", "eyebrow_id": "regular",