NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.52k stars 275 forks source link

Support of Implicit Tiling #608

Open AnthonyGlt opened 1 month ago

AnthonyGlt commented 1 month ago

Implicit Tiling

I wish to implement the support of Implicit Tiling (introduced in 3D Tiles 1.1). It has been discussed in different issues but is there already a plan or ideas how to do it ?

I've seen that in Cesium, the implicit tiling is directly managed from Cesium3DTileset, which is kind of the equivalent of TilesRendererBase here. Do you think I should do a similar implementation ?

I've also noticed the recent addition of plugins, will it be a better idea to implement a ImplicitTilingPlugin with the necessary hooks ? What is your take on this topic ?

Do you have any tips/warnings to help me in this new implicit tiling support in 3DTilesRendererJS ?

I'll first begin by the parsing of the .subtree files.

Thank you

gkjohnson commented 1 month ago

Hello! A contribution to support implicit tiling would be great - there hasn't been thought put into this feature yet, though, so your help here would be appreciated. As far as I understand the feature requires support for something akin to "virtual" tile children that have implicitly calculated bounding volumes and content URLs. Is that a reasonable summary?

Do you think I should do a similar implementation ?

I'm less familiar with the Cesium3DTileset implementation for this. Do you mind giving a brief description of what a similar implementation would look like?

Do you have any tips/warnings to help me in this new implicit tiling support in 3DTilesRendererJS ?

I think one of the larger things that will need to be considered here is how to handle these "virtual" child tiles since there's a lot of intermediate information stored on the tile object for the sake of traversing and loading data. I was originally thinking we'd want to avoid generating child tile representations for each implicit child but that may be an okay place to start since we'll ultimately have to create an object to store the intermediate data, anyway - whether it's stored as a child or somewhere else. An optimization here could be deleting all child objects to free up memory as soon as a tile is unloaded as the camera moves.

I'm curious as how Cesium is handling this already if you know, though.

I've also noticed the recent addition of plugins, will it be a better idea to implement a ImplicitTilingPlugin with the necessary hooks ? What is your take on this topic ?

I think this should be enabled by default but using a plugin could help compartmentalize the logic a bit more - once we have a more solid idea of how this should be implemented I think it will be easier to say.

AnthonyGlt commented 1 month ago

Thank you for the answer I have a draft of an implementation. I'll open a MR soon, once the code is cleaner. I'll explain the structure, i've tried to keep intact the existing TilesRenderer architecture. My MR will concern a limited scope of the implicit tiling for now, depending on the time I have to work on it.

I'll bring more infos in the MR, i've just wanted to notice you that I was still on it and I have good results :+1:

AnthonyGlt commented 4 weeks ago

The MR : https://github.com/NASA-AMMOS/3DTilesRendererJS/pull/650

@gkjohnson

AnthonyGlt commented 1 week ago

TODOs:


- [ ] Multiple Contents support. Only one content is supported for now
- [ ] Test implicit tiling defined in children

**CODE IMPROVEMENTS:**

- [ ] Homogeneous use of `preprocessNode` by not overwriting content.uri (cf. ImplicitTilingPlugin using `uri` instead of `tilsetDir`) https://github.com/NASA-AMMOS/3DTilesRendererJS/pull/650#discussion_r1707207298
- [x] Remove three.js dependence https://github.com/NASA-AMMOS/3DTilesRendererJS/pull/650#discussion_r1692507901
- [ ] Implement a different condition to target subtree tile than the file extrension `.subtree `in the ImplicitTilingPlugin
- [ ] Merge requestTileContents fetch calls using TextDecoder, check if plugin can process json before assuming it's an external tile set.
gkjohnson commented 1 week ago

If you're looking for other, more complete tile sets to try out and test - these Cesium ion tile sets include implicit tiling roots:

See this Cesium sandbox demo.