fix(tooling): depth-only epsilon bias for the clip discriminator + corrected findings

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 14:59:32 +02:00
co-authored by Claude Fable 5
parent 74fa16260d
commit b09a50efbf
2 changed files with 16 additions and 6 deletions
+15 -6
View File
@@ -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"
+1
View File
@@ -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",