Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2fa33b5
Add Hierarchy Mode to Vertex AO tool
claude Apr 17, 2026
b29fdfc
Cache hierarchy entries across OnGUI passes
claude Apr 17, 2026
4278e69
Per-FBX granular control in Vertex AO Hierarchy Mode
claude Apr 17, 2026
019514b
Fix ExecuteBake compile error and preserve include toggles
claude Apr 17, 2026
98cd65e
Skip zero-vertex meshes in AO bake
claude Apr 17, 2026
3d7f690
Ping on row label click in Vertex AO lists
claude Apr 17, 2026
25a410b
Preserve fresh AO across FBX overwrite reimport
claude Apr 17, 2026
16eb0d4
Apply AO to every matching FBX clone, not just the first
claude Apr 17, 2026
a1e709a
Tighten hierarchy cache + FBX clone matching
claude Apr 17, 2026
b1c5b65
Widen Nearby occluder search + deep collider walk
claude Apr 17, 2026
261c5f0
Diagnose FBX overwrite AO path
claude Apr 17, 2026
f025b47
Snapshot AO pre-reimport + scene-wide occluder search
claude Apr 17, 2026
994e6ba
Colliders replace renderers where matching, per option 2
claude Apr 17, 2026
92e183c
Simplify collider↔renderer match to trailing _COL only
claude Apr 17, 2026
9b3e65d
Detect colliders by mesh-name "_COL" suffix, not node name
claude Apr 17, 2026
ad1e7fe
Drop mesh-ID dedup in collider collection
claude Apr 17, 2026
c52576a
Stop checkbox clipping the first label character
claude Apr 17, 2026
97bc18a
Restrict Overwrite FBX list to included meshes only
claude Apr 17, 2026
18eddce
Skip hierarchy normalization for in-place FBX overwrite
claude Apr 17, 2026
5b00b1b
Loosen Meshes list rows, drop inline FBX name
claude Apr 17, 2026
f304d02
Add row-count slider for Meshes / Overwrite FBX lists
claude Apr 17, 2026
d81ae8e
Trim cleanup debt from hierarchy mode experiments
claude Apr 17, 2026
e92c1da
Split OnDrawSidebar into section helpers
claude Apr 17, 2026
6b43932
Add UV1 hierarchy pack tool
claude Apr 17, 2026
97a82cb
Fix two Codex follow-ups
claude Apr 17, 2026
da41184
Wire row click to scene selection for UV canvas preview
claude Apr 17, 2026
6fa8ddf
Auto-select first packed renderer so UV canvas shows preview
claude Apr 17, 2026
a26b49d
Stabilize LOD generation + per-LOD regenerate in ModelBuilder
claude Apr 17, 2026
74f5097
Clamp vertex AO to [0,1] + document linear color-space semantics
claude Apr 17, 2026
cce3ecd
Remove empty AtlasPack / Uv0Optimize stub tools
claude Apr 17, 2026
c8fd1be
Extract LOD generation core to LodPipelineOps
claude Apr 17, 2026
9be46bf
Add BuildValidator for Model Builder pipeline
claude Apr 17, 2026
1ff7462
Add Build Pipeline section to Model Builder
claude Apr 17, 2026
868b107
Rename Model Builder tool to Prefab Builder
claude Apr 18, 2026
3a64867
Migrate namespace to SashaRX.UnityMeshLab in remaining files
claude Apr 24, 2026
2b9f292
Address Codex review feedback on PR #103
claude Apr 27, 2026
d6a9905
Add Solid Color batch export with variant pipeline and layer stack ar…
SashaRX Apr 27, 2026
1a376f7
Preserve LOD group prefixes when exporting multi-group hierarchies
claude Apr 28, 2026
a5bc09e
Skip hierarchy normalization in Overwrite FBX (Vertex Colors)
claude Apr 28, 2026
467dd0e
Address Codex review feedback on PR #103 (post-rebase)
claude Apr 28, 2026
8f3a24c
Add MeshLabArtifactValidator to detect bad external MeshLab settings …
SashaRX May 2, 2026
6806629
Add FBX pipeline regression checklist
claude May 2, 2026
ffde751
Add FBX pipeline regression checklist (#110)
SashaRX May 2, 2026
5ccbc2a
Add isolated-channel FBX export
claude May 2, 2026
21dd13d
Document isolated re-save contract in FBX pipeline checklist
claude May 3, 2026
3164fd4
Consolidate vcolor + isolated-channel paths into single export core
claude May 3, 2026
702ec1f
Atomic FBX overwrite + pre-export preflight in core
claude May 3, 2026
2e9c66a
Wire ExportFbx through FbxExportIntent; narrow path delegates to core
claude May 3, 2026
67aadab
Merge claude/fbx-pipeline-checklist-nU9q2
claude May 3, 2026
3b953f1
Migrate PrefabBuilderTool save to narrow FbxExportIntent
claude May 3, 2026
224709b
Address Codex review feedback on PR #103 (FbxExportIntent migration)
claude May 3, 2026
dab24f8
Fix CS0266 on meshOptimizationFlags snapshot variable
claude May 3, 2026
68fb1cd
Move Mesh Lab window opener into submenu to avoid menu collapse
claude May 3, 2026
bb8df3b
Address Codex review batch on PR #103
claude Jul 18, 2026
2912378
Fix isolated-export vertex-count mismatch (Codex #7)
claude Jul 18, 2026
c45a9ec
Merge origin/main into claude/bake-ao-single-hierarchy-27AwS
claude Jul 19, 2026
a327adf
Build native libraries (auto) [skip ci]
github-actions[bot] Jul 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
- Assets ▸ Create context menu: `Mesh Lab ▸ Sweep Test Suite` (was always-visible `Lightmap UV Tool/Test Suite` via `[CreateAssetMenu]`).
- **In-flight gate + `FireAndForget` helper** for fire-and-forget async UI actions. The "Run Full Pipeline" / "Run Repack only" / "Run Transfer only" / "Repack All" / "Transfer All Targets" buttons now sit inside an `EditorGUI.DisabledScope` on `_pipelineInFlight` so a second click can't launch an interleaving run; `FireAndForget` attaches `ContinueWith` on the Unity sync context to log Task faults through `UvtLog.Error`, release the gate, and call `UvProgress.Fail` so a thrown exception can't leave the strip stuck on a stale phase.
- **Cancel-aware benchmark recording** in `ExecTransferAllImpl` — mirrors the `completedSuccessfully` guard `ExecFullPipelineImpl` already uses. Cancelled transfers no longer emit stale `shellTransferResult` / validation rows that taint sweep aggregates.
- **Solid Color bake mode.** Fills `mesh.colors32` with a uniform `Color32` across every mesh variant of an entry (`originalMesh`, `repackedMesh`, `transferredMesh`, `fbxMesh`). Collision meshes are skipped via `MeshHygieneUtility.IsCollisionNodeName`. Each write goes through `Undo.RecordObject` + `EditorUtility.SetDirty`.
- **Batch variant export pipeline.** New `VariantExportPipeline` (`Editor/Tools/VariantExportPipeline.cs`) drives a list of `(Color, suffix)` variants against a source FBX and an optional source prefab. Per variant it paints, exports `{base}_{suffix}.fbx`, instantiates the source prefab, unpacks it (full clone, not a Prefab Variant), swaps `MeshFilter.sharedMesh` to the matching new sub-mesh by name, and saves `{base}_{suffix}.prefab`. Each variant completes its own export → import → clone cycle, with a single `AssetDatabase.Refresh` at the end. Suffixes are validated against `^[A-Za-z0-9_]+$` and duplicates inside a batch are rejected upfront. Conflicts are overwritten — git is the rollback path.
- **`LightmapTransferTool.ExportVertexColorsToFbxAs(sourceFbxPath, outputFbxPath, entries, uvChannelOverride)`** — public entry point that writes a new FBX next to (or anywhere relative to) the source without mutating the source importer, scene mesh bindings, or working copies.

### Changed
- **Vertex AO tab renamed to Vertex Color Baking.** `VertexAOTool` → `VertexColorBakingTool`, `ToolId` `vertex_ao` → `vertex_color_baking`. Asset GUID preserved so existing references stay intact. AO functionality is unchanged and reachable via the new toolbar at the top of the tab.
- **Default `RepackResolutionMode` is now `AutoFromTexelDensity`** (was `Manual`). Uniform real-world texels-per-meter is the desired outcome for lightmaps; the previous fixed-resolution default produced wildly different texel density per asset depending on world size.
- **xatlas pack no longer raises a modal progress dialog** (`EditorUtility.DisplayCancelableProgressBar`). Progress now flows through `UvProgress` to the Background Tasks panel and the inline strip; cancel via `UvProgress.CancelRequested`.
- **Hoisted all late `sourceMesh.*` and `targetMesh.*` reads** in `GroupedShellTransfer.Transfer` up to the initial Mesh-data extraction block. Keeps the algorithm body Unity-API-free so it runs cleanly in `Task.Run`.

### Refactored
- `LightmapTransferTool.ExportVertexColorsToFbxCore` now accepts an optional `outputFbxPathOverride` and returns `bool` for success. When the override is set and differs from the source path, Phase 1 (source importer mutation), Phase 4 scene relink, and Phase 5 restore are skipped so the source FBX and live scene stay untouched. Existing overwrite and hierarchy-mode callers keep their void-style usage.

### Removed
- All `EditorUtility.DisplayProgressBar` / `DisplayCancelableProgressBar` / `ClearProgressBar` calls. Replaced with `UvProgress` everywhere (XatlasRepack, LightmapTransferTool, VertexAOBaker.Cpu, FbxMetricsExporter, LodGenerationTool).
- `[CreateAssetMenu(menuName = "Lightmap UV Tool/Test Suite")]` from `TestSuiteAsset` — replaced with a gated `[MenuItem("Assets/Create/Mesh Lab/Sweep Test Suite")]`.
Expand Down
47 changes: 47 additions & 0 deletions Documentation~/EXPERIMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,53 @@
- `FixMeshStripUvs()` — vertex colors `(0,0,0,0)` может быть валидное AO (полная окклюзия). Авто-стрип colors убран.
- `SaveAndReimport()` в cleanup — добавлять `bypassPaths` чтобы постпроцессор не вмешался.

---

## External MeshLab (desktop) — Settings to Avoid Artifacts

> Обновлено: 2026-05-02
>
> Применимо к FBX, прошедшим через десктопный **MeshLab** (https://www.meshlab.net/) перед импортом в Unity. Не путать с пакетом **UnityMeshLab** — это про внешний инструмент.
>
> Программная проверка симптомов: `MeshLabArtifactValidator` (`Editor/MeshLabArtifactValidator.cs`),
> menu **Tools → Mesh Lab → Validators → Check Imported MeshLab Artifacts** (по выделенному GameObject/asset).

### Filters — что ломает геометрию

1. **Merge Close Vertices** — `Distance` ставить очень маленьким (`1e-6`) или отключать filter.
- На дефолтном threshold склеивает per-wedge UV-вершины в одну → **UV seams разъезжаются**, текстура «плывёт» по швам.
- Симптом в Unity: `mesh.vertexCount == уникальных позиций`, при том что в сцене заметны видимые швы.

2. **Parameterization (UV1)** — выбирать filter с поддержкой существующих UV seams: `Trivial Per-Triangle Parameterization` или `Iso Parametrization`.
- Дефолтный `Parameterization: Flat Plane` ломает развёртку UV1 (весь mesh проецируется в одну плоскость).
- Симптом: UV1 — degenerate triangles или всё в `(0,0)`.

3. **Remove Duplicate Faces / Remove Duplicate Vertices** — отключать, если есть split UVs.
- В 3ds Max split UVs выглядят как «дубликаты» по позиции (но имеют разные UV/normal).
- MeshLab их склеивает → теряются UV seams и smoothing groups.

### Export FBX dialog — обязательные настройки

| Опция | Значение | Зачем |
|-------|----------|-------|
| `WedgeAllChannels` | **ON** | Сохраняет per-wedge UV / normal (т.е. split UVs / smoothing seams). |
| `UseExistingNormals` | **ON** | Не пересчитывает нормали (иначе теряются smoothing groups → flat shading). |

### Симптомы плохих настроек в Unity (что ловит валидатор)

- **No UV seams**: `vertexCount` ≈ числу уникальных позиций при наличии нескольких UV-островов → `Merge Close Vertices` или `Remove Duplicate Vertices` склеили wedge.
- **Flat-shaded normals**: > 90% треугольников имеют 3 одинаковых vertex-нормали, совпадающих с face-normal → нормали пересчитаны без сохранения smoothing.
- **Degenerate UV1**: > 5% треугольников UV1 с нулевой площадью — broken parameterization.
- **UV1 all zero**: все UV1 в `(0,0)` — MeshLab стёр UV1 канал.
- **UV1 out of unit**: > 5% UV1-вершин вне `[0..1]` — Flat Plane / Iso без нормализации.

### Проверка

Перед импортом FBX из MeshLab в Unity:
1. Прогнать `Tools → Mesh Lab → Validators → Check Imported MeshLab Artifacts` на корне.
2. Если warning — пересохранить из MeshLab с правильными настройками.
3. Если повторяется — отключить проблемный filter и переэкспортировать.

## Эксперимент 2026-05-13 — Pre-pack snap к integer atlas pixels (отклонено)

**Гипотеза:** xatlas `PackCharts` применяет unconditional per-chart `ceil(extents)` rescale (xatlas.cpp:8345-8362) — sub-pixel-thin шеллы амплифицируются и ломают uniform density. Если pre-snap'ить UV extents per-shell к integer pixel grid до xatlas, ceil() становится no-op'ом и density сохраняется без форка xatlas.
Expand Down
Loading