CesiumGS / 3d-tiles

Specification for streaming massive heterogeneous 3D geospatial datasets :earth_americas:
2.11k stars 467 forks source link

AsciiDoc conversion experiments #682

Closed javagl closed 2 years ago

javagl commented 2 years ago

A DRAFT of the first experiments for converting the specification to AsciiDoc (see https://github.com/CesiumGS/3d-tiles/issues/590 )

javagl commented 2 years ago

The current state is that it contains a specification/Specification.adoc that was largely auto-generated from the specification/README.md, and that can be used to create first, basic (not-so-pretty) PDF and HTML outputs. It also contains a BUILDING.md with some instructions for this process.

javagl commented 2 years ago

An update and some sort of checklist

The conversion of the "core" of the specification to AsciiDoc is largely done. The JSON schema property references are still missing.

Regarding the core specification

It is possible to generate the single-page HTML version of the specification. And it is possible to generate the single-document PDF version of the specification.

What is still to be done:

Regarding the property references

As usual, the "core" was the 80% of the work that took 20% of the time. The JSON schema property reference is supposed to be generated with wetzel, and quite some work will have to go into that.

A short summary of what has to be done:

If When the property references can be created as individual AsciiDoc files, then it should be easy to integrate them here. A first experiment was done in https://github.com/javagl/3d-tiles/commit/226a5bf00c618b6dcdfc66f2f1ea6fcc8892ef3a (not yet part of this PR), and there was no obvious blocker for this part until now.

javagl commented 2 years ago

To elaborate on one aspect of the Linking and structure point mentioned above:

wetzel inserts links from the "Property Reference" to the JSON schema. For example, see glTF:

(An aside: Note that the Property Reference is normative, while the JSON schema is not normative!)

I assume that a similar solution should also be found for 3D Tiles. On a very basic level, this already works:

Cesium 3DTilesSpec Links

This cross-linking takes place has some caveats. In the current state, wetzel generates this by writing out include::schema/example.schema.json statements into the AsciiDoc document. Actually resolving that (when generating the HTML) is left to AsciiDoc itself. The directory - schema in the example - is configured via a command-line parameter. So does not work out-of-the-box when the schema directory could actually be schema/TileFormats. For now, I took the approach of actually inlining the schema files into the AsciiDoc document. But this has to be re-evaluated at some point.

On top of that, all this raises a bunch of questions regarding links:

But I'll try to sort all that out...

javagl commented 2 years ago

An update with the latest state:

Regarding the core specification

Most of the recent changes have been link fixes (details in previous comments). One goal was to make sure that links work (in general... and) on GitHub as well as the PDF/HTML output. For example, one can now browse at https://github.com/javagl/3d-tiles/blob/asciidoc-conversion/specification/README.adoc and click the first link to glTF Tile Format, and actually end up at the right page, and this link still works in the single-page HTML file or the PDF document.

(It will take a few iterations until all broken links are weeded out, but most of them should already work...)

Regarding the property reference

A large refactoring of wetzel is in progress. In the current form, it has so many issues with the 3D Tiles spec that the tl;dr can only be: "It does not work (period)". Some early experiments with that less-then-ideal wetzel output are in https://github.com/javagl/3d-tiles/tree/asciidoc-conversion-experiments , but more work will have to go into that.


Preview:

The current state of the PDF is attached here. Note that this is a compressed version, with low-resolution images. (The original one has 45MB, because of the large PNG files. Compressing that PDF is a pain in the back, and requires a carefully selected version of GhostScript - details are given in the build instructions)

Specification-1.1.0-compressed.pdf

javagl commented 2 years ago

An updated state of the specification is attached here. This time with a Property Reference and a JSON Schema Refrence section.


Some notes about the property reference and wetzel:

The property reference is based on a local version of wetzel that does not have much in common with what is currently in the wetzel repository (c.f. https://en.wikipedia.org/wiki/Ship_of_Theseus ). If this is supposed to ever be made public, I'll have to do lots of cleanups, but even then, it's not unlikely that the changes are not considered to be "improvements", and therefore, might never be merged.

At some points, the 3D Tiles spec is already hitting a limit of which sort of documentation can be auto-generated from the schema. While most the browsing/linking should currently work - for example, linking from b3dm.featureTable.BATCH_LENGTH to the type featureTable-definitions-globalPropertyInteger - there are types that simply have no names, and thus, can hardly be squeezed into a form that does not boil down to a plain ADOC/MD version of the JSON schema itself. We might even consider changing the schema if we wanted to improve browsability here.


Specification-1.1.0-compressed-2022-05-22.pdf

javagl commented 2 years ago

I'll mark this as "ready for review" now. There certainly are still some issues (probably some links not working), or possible improvements (as in ~"That's not how you do this in AsciiDoc!"), but it should currently be a reasonably consistent state.

A summary of some possibly relevant points:

Previews of the resulting specifications are attached here.

The PDF file was compressed (as described in the build instructions). For the HTML version, I downscaled/compressed the images, but the HTML file can just be dropped into the local 3dtiles/specification subdirectory to see it with the original images. (I didn't want to upload 90MB here, due to a slow connection).

Specification-1.1.0-compressed-2022-06-26.pdf

3d-tiles-Specification-HTML-compressedImages-2022-06-26.zip

javagl commented 2 years ago

I wrote some comments to the inlined ones, and summarize them as a short TODO list here:

javagl commented 2 years ago

An aside: I added the logo and an introductory sentence to the (GitHub-rendered version of the) README.adoc that is shown at https://github.com/javagl/3d-tiles/tree/asciidoc-conversion/specification . But we might consider to create a dedicated README.md for this directory. The current README.adoc that contains the actual specification text could then be something like MAIN_SPECIFICATION.adoc or so.

This new "top-level" README.md could then be something like


Specification

Hi there, look, all this is ADOC now, here's the entry point for 3D Tiles 1.1: MAIN_SPECIFICATION.md

Here are some PDF files: Specification-1.1.0.pdf ...

...


so that this directory/README.md rather serves as "the entry point" for all spec-related documents (similar to https://github.com/KhronosGroup/glTF/tree/main/specification )

(Not a strong opinion, just a thought...)

lilleyse commented 2 years ago

This new "top-level" README.md could then be something like

Eventually this might make sense, but it is another level of indirection that I don't think is worth it right now.

javagl commented 2 years ago

The latest commits remove the now obsolete .md files, and update the links that had been pointing directly to these Markdown files from other parts of the repository. (This was mainly from the former 'next' extensions).

One thing that I remembered while doing this: Some of the Markdown documents contained a local Table Of Contents (e.g. the Metadata/README.md). These TOCs can not directly be part of the AsciiDoc files when they are supposed to be combined into a single PDF/HTML. So the Metadata/README.adoc does not contain a TOC.

Using the ifdef::env-github[] construct, we could insert a TOC that only would show up on GitHub. This may impose some maintenance effort (because these TOCs cannot be generated automatically, as it was done with the MarkdownAllInOne VS plugin). But if this is desired, I could add these TOCs. (They had all been removed in a single commit: https://github.com/javagl/3d-tiles/commit/3d4971495e4219572d50b02b799ef942cd7fc37a )

lilleyse commented 2 years ago

Let's skip the TOC for now.

lilleyse commented 2 years ago

I noticed a lot of changes when I generated the property reference with wetzel locally. Does the property reference need to be re-generated now that https://github.com/CesiumGS/3d-tiles/pull/688 is merged?

javagl commented 2 years ago

Indeed, the state here was generated based on a state without BinaryBodyOffset. Updated it with the latest state.

lilleyse commented 2 years ago

Thanks @javagl! A huge amount of work went into this and I'm glad to see it merged.