fix: distinguish requested and safety decimation
This commit is contained in:
parent
83cf977a8f
commit
1488ba1505
@ -274,7 +274,11 @@ def _run_pbr_attempts(
|
|||||||
attempt = {
|
attempt = {
|
||||||
"baker": baker,
|
"baker": baker,
|
||||||
"target_faces": target,
|
"target_faces": target,
|
||||||
"technical_safety_target": target == SAFETY_FACE_TARGET and raw_faces > SAFETY_FACE_TARGET,
|
"technical_safety_target": (
|
||||||
|
requested_target is None
|
||||||
|
and target == SAFETY_FACE_TARGET
|
||||||
|
and raw_faces > SAFETY_FACE_TARGET
|
||||||
|
),
|
||||||
}
|
}
|
||||||
attempt_started = time.perf_counter()
|
attempt_started = time.perf_counter()
|
||||||
try:
|
try:
|
||||||
@ -533,9 +537,13 @@ def main() -> int:
|
|||||||
|
|
||||||
metadata["candidate_pbr"] = _candidate_stats(candidate_path, exported)
|
metadata["candidate_pbr"] = _candidate_stats(candidate_path, exported)
|
||||||
metadata["candidate_pbr"].update(chosen)
|
metadata["candidate_pbr"].update(chosen)
|
||||||
metadata["candidate_pbr"]["technical_decimation"] = bool(
|
metadata["candidate_pbr"]["decimated"] = bool(
|
||||||
chosen["target_faces"] is not None and chosen["target_faces"] < raw_faces
|
chosen["target_faces"] is not None and chosen["target_faces"] < raw_faces
|
||||||
)
|
)
|
||||||
|
metadata["candidate_pbr"]["technical_decimation"] = bool(
|
||||||
|
metadata["candidate_pbr"]["decimated"]
|
||||||
|
and chosen["technical_safety_target"]
|
||||||
|
)
|
||||||
metadata["timings_seconds"]["pbr_export"] = round(time.perf_counter() - pbr_started, 3)
|
metadata["timings_seconds"]["pbr_export"] = round(time.perf_counter() - pbr_started, 3)
|
||||||
from trellis2.gltf_validation import validate_output_pair
|
from trellis2.gltf_validation import validate_output_pair
|
||||||
|
|
||||||
|
|||||||
@ -98,6 +98,24 @@ def test_explicit_kdtree_never_loads_metal():
|
|||||||
assert list(generate_asset._attempt_schedule("kdtree", None, 1000)) == [("kdtree", None)]
|
assert list(generate_asset._attempt_schedule("kdtree", None, 1000)) == [("kdtree", None)]
|
||||||
|
|
||||||
|
|
||||||
|
def test_explicit_200k_target_is_not_mislabeled_as_safety_fallback(tmp_path: Path):
|
||||||
|
def fake_export(mesh, path, *, baker, target, texture_size):
|
||||||
|
path.write_bytes(b"candidate")
|
||||||
|
return object(), True
|
||||||
|
|
||||||
|
_, chosen, _ = generate_asset._run_pbr_attempts(
|
||||||
|
_mesh(800_000),
|
||||||
|
tmp_path / "candidate_pbr.glb",
|
||||||
|
preferred_baker="kdtree",
|
||||||
|
requested_target=200_000,
|
||||||
|
texture_size=512,
|
||||||
|
export_fn=fake_export,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert chosen["target_faces"] == 200_000
|
||||||
|
assert chosen["technical_safety_target"] is False
|
||||||
|
|
||||||
|
|
||||||
def test_raw_export_preserves_full_topology_and_writes_vertex_normals(tmp_path: Path):
|
def test_raw_export_preserves_full_topology_and_writes_vertex_normals(tmp_path: Path):
|
||||||
vertices = torch.tensor(
|
vertices = torch.tensor(
|
||||||
[
|
[
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user