iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.07k stars 292 forks source link

[Proposal - 3D Tiles] Use an external library for 3D Tiles support #2225

Open jailln opened 8 months ago

jailln commented 8 months ago

This issue is a feature proposal. Feel free to upvote (with 👍 ), comment and provide your use-cases if you're interested by this feature.

Context

(Originally discussed in https://github.com/iTowns/itowns/discussions/2146)

3D Tiles support in itowns is good but could be improved. 3D Tiles format is quite complex and maintaining its support is costly. In addition, 3D Tiles 1.1 has been released recently.

Proposal

Analyze the pros and cons and the different possibilities for using an external library to support 3D Tiles in itowns and decide if we should use one or keep the 3D Tiles support in itowns.

We have identified three possible libraries:

The (unordered) elements to bear in mind when analyzing external libraries are:

Potential Problems

Documentation

Given the wide variety of 3D Tiles datasets available and of the variety of possible representations (meshes with or without textures, point clouds, gltfs, instanced meshes, multiple possible bounding volumes, draco and ktx2 compression, etc., etc.), we need to test against multiple datasets. Here are some public datasets that I have gathered. I also have datasets that I cannot share but I can run tests on them and post the results:

3D Tiles 1.0

b3dm without textures:

b3dm with textures:

pnts

i3dm:

3D tiles 1.1

Other possible sources:

For benchmarking, I identified three common usecases that can be tested:

Some indicators that should be analyzed are:

jailln commented 8 months ago

A summary of my analysis and conclusion about the 3 libraries and about what we should do in my opinion (possible to give more information on demand on specific points).

3DTilesRendererJS:

Analysis:

My opinion: Could be a quick win to improve 3D Tiles support and to reduce maintainance on this format but with a lot of drawbacks (point clouds perfs, bus factor, threejs peer-dependency).

three-loaders-gl:

Analysis:

My opinion: too risky and not enough gain.

loaders.gl:

My opinion: Most of the 1.0 and 1.1 spec is supported by loaders.gl, good community, architecture and tests, it's the most promising one. Waiting on @Desplandis and @mgermerie POC to test its effective 3D Tiles support and its perfs once integrated to itowns.

Note that in the POC we should also determine whether we should use loaders.gl GLTFLoader or Threejs one or either one or the other depending on the dataset (considering support, especially for gltf 1.0, extensions and perfs).

PerspectivesLab commented 8 months ago

for the other 3D tiles possibilities: Other possible sources: you might consider the nexus projects, https://github.com/cnr-isti-vclab/nexus 3D web tile visualization of large models, see examples: https://3dhop.net/demo.php

jailln commented 4 months ago

Finally we've decided to go with 3DTilesRendererJS. I'll let @Desplandis and @mgermerie detail why we decided not to choose loaders.gl since they experimented it.

I've created the following document comparing itowns and 3DtilesRendererJS support of 3D tiles. We can also use it to follow the migration status.

I started the migration on the following branch

jailln commented 4 months ago

Here is a list of the work to do, you can put your name next to it if you start working on it so we don't step on each other's toes :) Don't hesitate to add stuff to it too.

V0:

V1:

V2:

Someday?

Desplandis commented 3 months ago

@jailln Forgot to answer this one. Nice job, we will assist you with @mgermerie on this one. =)

On the list of TODOs:

  • Share cache and queues between ThreeDTilesLayers
  • Analyze new options offered by 3d-tiles-renderer-js TilesRenderer, LRUCache and co and add them in ThreeDTilesLayer constructor config options

Yes, It would be cool to be able to centralize control of the cache and queues in iTowns.

  • Missing C3DTilesLayer options (decide if we should keep them or not: e.g. sseThreshold, cleanupDelay, registeredExtensions)

  • Batch table: provide an easy API to access batch table data (the same than before or a new one ?)

Shall we call for contributions on those topics ? By opening an issue on iTowns and/or on known projects using itowns' 3DTiles (e.g. UD-Viz)?

  • Point clouds

Yeah, we should be able to pass our own material. I could investigate the performance issues on this one.

  • Use (or provide the ability to use) 3dtilesrendererjs FadeTilesRenderer

Whoa, nice functionality to have!

  • Attached layers [...]

I will ask @gchoqueux for inputs.

To this list, we should add all 3D Tiles 1.1 functionalities that we will contribute back to 3d-tiles-renderer-js. =)