Skip to content

Add --progress: machine-readable JSON progress on stdout - #108

Open
zalmoxes-laran wants to merge 1 commit into
OpenDroneMap:masterfrom
zalmoxes-laran:progress-reporting
Open

zalmoxes-laran wants to merge 1 commit into
OpenDroneMap:masterfrom
zalmoxes-laran:progress-reporting

Conversation

@zalmoxes-laran

@zalmoxes-laran zalmoxes-laran commented Oct 27, 2026 •

Copy link
Copy Markdown

This adds an opt-in --progress switch that writes machine-readable progress on stdout, so that a program calling Obj2Tiles can show a real progress bar.

  • With --progress, Obj2Tiles prints one JSON object per line next to the usual log, e.g. {"stage":"splitting","lod":0,"done":5,"total":64,"percent":37.5}. Stages are decimation, splitting, tiling and packing (for .3tz); the run ends with {"stage":"done","percent":100,"elapsed":…} or {"stage":"error","message":"…"}, also when the options are rejected.
  • Without --progress the output is exactly what it is today. The usual log lines start with a space, so a caller keeps the lines that start with {.
  • The reporting lives in Stages/ProgressReporter.cs; the three stages receive an optional reporter (null when the switch is off).
  • Tests: Obj2Tiles.Test/ProgressReporterTests.cs and Obj2Tiles.Test/Quality/CliProgressTests.cs (10 tests, all passing with .NET SDK 10.0.403). README: one row in the options table.

Tried on a real textured mesh (a 3D survey of an architectural element, ~450k triangles): the native osx-arm64 build of this branch ran the default pipeline in 8.1 s using 812 MB, wrote a complete tileset (22 files, no errors) and the calling application (EMStudio, Extended Matrix, CNR-ISPC) drove its progress bar from these lines instead of estimating from the log.

Independent of #107 (osx-arm64 build); either can be merged first. Happy to rename the switch or adjust the format if you prefer something else.

With --progress, Obj2Tiles also writes one JSON object per line on stdout:
{"stage":"decimation|splitting|tiling|packing","done":n,"total":m,"percent":p}
(splitting lines carry "lod": done/total count that LOD's tiles, percent is
the whole stage), then {"stage":"done","percent":100,"elapsed":s} after the
cleanup, or {"stage":"error","message":"..."} on failure.

Decimation advances once per LOD, splitting once per tile written (per LOD),
tiling once per converted tile plus the root tile. Writes are serialized, so
parallel workers never interleave a line and done never goes backwards.

The human log is unchanged and stays on stdout (its lines start with a space;
a reader keeps the lines starting with '{'). Without --progress the output is
the same as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant