# Implicit tiling - request tiles from child subtree files

**URL:** <https://community.cesium.com/t/implicit-tiling-request-tiles-from-child-subtree-files/22048>\
**Category:** CesiumJS\
**Created:** [January 23, 2023, 2:08pm UTC](https://community.cesium.com/t/implicit-tiling-request-tiles-from-child-subtree-files/22048 "2023-01-23T14:08:26Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Marco13](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/marco13/32/2757_2.png) [@Marco13](https://community.cesium.com/u/Marco13)\
**Post date:** [January 30, 2023, 5:52pm UTC](https://community.cesium.com/t/implicit-tiling-request-tiles-from-child-subtree-files/22048/7 "2023-01-30T17:52:18Z")

</div>

There are some aspects of implciit tiling that are a bit hard to grasp. There are some degrees of freedom for implementations, and depending on the implementation, the purpose of certain parts may not be perfectly clear (we talked about CesiumJS apparently not using the `availableLevels`, in [Implicit tiling: availableLevels](https://community.cesium.com/t/implicit-tiling-availablelevels/19559) and IIRC a later thread).

* * *

A somewhat anecdotal example: I created an implementation for reading, traversing, creating and converting implicit tilesets. And at some point, I noticed: “Whoops. I didn’t use `childSubtreeAvailability` _anywhere_ in my code!”. Sure, I always ran this on the file system, and basically did an `if (exists(subtreeFile))` where necessary. The `childSubtreeAvailability` serves - _very_ roughly speaking - the purpose of _not_ having to do this kind of check. One has to keep in mind that when operating on the network, this would imply sending out thousands of requests that would be answered with 404s…

* * *

Regarding the `subtreeLevels`:

One could see the information in the `implicitTiling` JSON structure as two separate things.

1. The `subdivisionScheme` and `availableLevels` define the overall structure. Together with the `content.uri` (i.e. the template URI), they define the overall structure of the tileset, in a very abstract sense. They just say “This is an octree with 10 levels, and the content is in stored in files called `level_x_y_z.glb`”.

2. The `subtreeLevels` and `subtrees.uri` are information about _how this abstract data structure is **stored** _. It’s not possible or sensible to store the availability information for 10 million tiles and content in a single file. So the overall information is subdivided into subtrees. These subtrees are regular, and always have the same height (namely `subtreeLevels`). One can imagine the overall data structure to be divided into “layers” of subtrees.

There often are different ways how certain structures can be defined, or how certain information can be encoded. This may be related to your point:

> To retrieve the next level subtree file(s) it can be derived from the length of the childSubtreeAvailability (if its 4 → 1 level, if its 16 → 2 levels). When childSubtreeAvailability is empty in a subtree file I expected I could use any level for tile/content availability

If I understood this correctly, then this eventually leads to a structure where the heights of the “subtree layers” is not fixed. And that’s a valid (and interesting) point.

Until now, I think that you only intended to leave the number of levels for the “_leaf_ subtrees” open. As a generalization (just brainstorming now: ) one _could_ consider having an implicit tiling scheme where the first `subtree` has a height of 3, and its children have a height of 5, and its grandchildren have a height of 7. This could even be very generic, as in `subtreeLevelsProgression=CONSTANT/LINEAR/EXPONENTIAL` - or somehow defined _explicitly_ for each “layer” (as in something like `subtreeHeights: [3, 5, 7, INFINITE]`).

But one would have to think deeply about the implications for this on the spec- _and_ implementation (!) level - and.whether it could be expected to have benefits that are worthwhile. Having some regularity in the subtree structure may as well be beneficial here.

(An aside: It is also true that _some_ information can _sometimes_ be derived from other information. For example, the `subtreeHeight` could be derived from the `childSubtreeAvailability`. But as you said, this only works when the latter is present, so defining this _clearly_ and _unambiguously_ in the spec would be hard…)

* * *

Going up a few levels: I think the overarching question here is [How to make subtree division…](https://github.com/CesiumGS/3d-tiles/issues/576) that I linked to earlier.

When you have a tileset with 10 levels, you could choose `subtreeLevels=10,9,8...,2,1`, and the resulting _layout out the data itself_ (for the same abstract data structure!) would be vastly different. Many of them will be very wasteful - like `9` and `1`. The engineering questions here start with fairly trivial ones, e.g. whether `availableLevels` is divisible by `subtreeLevels`. But they quickly touch topics where there is no “one true answer” - for example: Which content is actually available? This determines whether you can structure the data in a way that nicely exploits the cases where you can use `constant:0/1` for the availability. On top of that are questions like “What are sensible file sizes for `subtree` files, to be transferred via network without large delays?”, or “Does the client/viewer use a smart approach to deal with this data?” (which leads to the CesiumJS issue that you linked to).

For now, I think that setting `subtreeLevels=ceil(availableLevels/2)` should be a good first shot. But this is just a gut feeling for now: Every potential insight of such ~~trial and err…~~ engineering has to be justified with experiments - i.e. with performance tests. And… designing these in a sensible form is a huge topic on its own…

---

_[View the full topic](https://community.cesium.com/t/implicit-tiling-request-tiles-from-child-subtree-files/22048)._
