feat(ugc): hidden faces removed as LU Toolbox's Remove Hidden Faces decides them

The 42 depth renders only saw faces in direct view, so faces reached only by
bounced light (interiors, recesses, rooms seen through openings) were removed.
UgcHsr traces the paths LU Toolbox's Cycles bake traces, directly from points
on each opaque triangle, and removes a triangle only when none of its paths
reaches the sky:

- points in rows along the triangle's longest side, hsr_sample_spacing apart
  (0.1143, 7 x 7 on a stud-sized square), at least hsr_min_points (28, the
  texels LU Toolbox bakes for a triangle), at most 4096
- hsr_samples (8) paths from each point, at most hsr_bounces (8) bounces, as
  Cycles 3.1 samples the bake material (Principled BSDF defaults: Burley
  diffuse and GGX specular, defensive sampling, Filter Glossy, 4 glossy
  bounces, Russian roulette from the second bounce, ensure_valid_reflection);
  no direct sky sampling (Cycles doesn't sample a flat world as a light)
- hsr_ground_plane: LU Toolbox's black box under LDD's floor
- decided per triangle, deterministic per model; triangles without area removed
- the VC pre-pass isn't done

Checked against LU Toolbox's operator in Blender 3.1.2 on the same meshes (27
models, 937,814 triangles): 501,362 removed there, 501,172 here, differences
as large as LU Toolbox's own between seeds. optimize_resolution is retired;
remove_hidden_faces=0 makes the same files as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-28 17:33:47 -05:00
parent 261fc60558
commit bea6b17b25
12 changed files with 1012 additions and 158 deletions

View File

@@ -111,11 +111,17 @@ satin_colors=360,362,363,364,365,366,367,376
satin_opacity=75
satin_whiten=20
# Remove faces that can't be seen from anywhere (optimize_resolution: detail of the renders that decide it;
# hsr_ground_plane: 1 also removes what can only be seen from below the model)
# Remove faces that can't be seen from anywhere, as LU Toolbox's Remove Hidden Faces: paths are traced from points on
# each opaque triangle, bouncing off the model; a triangle none of whose paths reaches the sky is removed.
# hsr_ground_plane: 1 also removes what can only be seen from below the model. hsr_samples: paths from each point.
# hsr_bounces: bounces a path may take. hsr_sample_spacing: distance between the points in LDD units (a stud is 0.8).
# hsr_min_points: points on a triangle at least, however small it is (LU Toolbox bakes 28 texels a triangle).
remove_hidden_faces=1
hsr_ground_plane=0
optimize_resolution=1024
hsr_samples=8
hsr_bounces=8
hsr_sample_spacing=0.1143
hsr_min_points=28
# Bake ambient occlusion into the vertex colors: rays per vertex, how far they look, strength 0 (none) to 1, and how
# much glowing colors add