re: calibrate the connectivity cap -- +612 resources against 18 consistency regressions
XBG7_EDGE_CAP / XBG7_SMALL_TRIS make the threshold sweepable (defaults unchanged, full suite green). Above 0.417 the capture-proven eng_02_l anchors exactly right and no e106 part regresses, and nothing that decoded at 0.28 is lost -- but ~250 existing anchors move silently and 18 shared resources lose cross-container consistency. Not changed: the movers have no oracle yet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -708,6 +708,27 @@ pub fn debug_find_index_buffer(bytes: &[u8], name: &str, vb: usize) -> Vec<(usiz
|
||||
out
|
||||
}
|
||||
|
||||
/// The connectivity cap: a searched block whose mean triangle edge exceeds this
|
||||
/// fraction of its bounding-box diagonal is rejected. `0.28` is the shipped
|
||||
/// value. A runtime capture names blocks the engine really draws, and one of them
|
||||
/// (`e106_eng_02_l`, a 24-triangle LOD) measures **0.417** — so the cap has a
|
||||
/// known false positive. `XBG7_EDGE_CAP` overrides it for calibration sweeps;
|
||||
/// it is a diagnostic knob, not a setting (see docs/re/structures/xbg7-mesh.md).
|
||||
fn edge_cap() -> f32 {
|
||||
std::env::var("XBG7_EDGE_CAP").ok().and_then(|v| v.parse().ok()).unwrap_or(0.28)
|
||||
}
|
||||
|
||||
/// Triangle count below which the looser [`small_cap`] applies. `0` (default)
|
||||
/// disables the split, so the flat [`edge_cap`] governs every block.
|
||||
fn small_tris() -> usize {
|
||||
std::env::var("XBG7_SMALL_TRIS").ok().and_then(|v| v.parse().ok()).unwrap_or(0)
|
||||
}
|
||||
|
||||
/// The connectivity cap for blocks below [`small_tris`] triangles.
|
||||
fn small_cap() -> f32 {
|
||||
std::env::var("XBG7_EDGE_CAP_SMALL").ok().and_then(|v| v.parse().ok()).unwrap_or(0.45)
|
||||
}
|
||||
|
||||
/// Internal: the descriptor parameters the diagnostics need.
|
||||
fn decl_of(bytes: &[u8], name: &str) -> Option<(VertexDecl, Vec<(usize, usize)>)> {
|
||||
if bytes.len() < 16 || &bytes[..4] != b"XPR2" {
|
||||
@@ -987,7 +1008,13 @@ fn validate_block(
|
||||
.sqrt()
|
||||
.max(1e-6);
|
||||
let mean_edge = edge_sum / (sampled as f32 * 3.0);
|
||||
if mean_edge / diag > 0.28 {
|
||||
// A COARSE block is coarse by construction: a 24-triangle LOD's edges
|
||||
// are a large fraction of its own size, which is why the flat cap has a
|
||||
// capture-proven false positive (`e106_eng_02_l`, ratio 0.417). Under
|
||||
// `XBG7_SMALL_TRIS` blocks below that triangle count get the looser
|
||||
// `XBG7_EDGE_CAP_SMALL` instead — a targeted relaxation, off by default.
|
||||
let cap = if tris < small_tris() { small_cap() } else { edge_cap() };
|
||||
if mean_edge / diag > cap {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user