Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 3d tile traversal - Part 1 #540

Merged
merged 2 commits into from
Dec 12, 2019
Merged

Refactor 3d tile traversal - Part 1 #540

merged 2 commits into from
Dec 12, 2019

Conversation

xintongxia
Copy link

@xintongxia xintongxia commented Nov 28, 2019

This PR is the first step of refactoring the 3d-tiles traversal. Added a base traversal class (base-tileset-traverser.js) which could be shared by both Cesium's 3d-tiles and ArcGIS's i3s tiles traversal.

The example app examples/i3s/deck.gl/ is for testing purpose. Eventually these should be merged with 3d-tiles example examples/deck.gl/3d-tiles

Next steps:

  • update documentations
  • refactor tile-header and tileset classes, which could be shared by both tiles
  • refactor tile layer to be able to render both tiles
  • evaluate the logic of empty tile traversal, tile optimization, tile expiration

demo 1

demo 2

@coveralls
Copy link

coveralls commented Nov 28, 2019

Coverage Status

Coverage decreased (-0.3%) to 49.498% when pulling 6b6f07d on xx/i3s into f00b344 on master.

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some initial comments, ignore if they don't make sense. I probably haven't understood all the ideas in this PR yet.

Regarding the example name, the idea is one subfolder per 3D framework: examples/i3s/deck.gl/app.js -> examples/deck.gl/i3s/app.js

examples/i3s/deck.gl/app.js Show resolved Hide resolved

this._memWidget = new StatsWidget(lumaStats.get('Memory Usage'), {
framesPerUpdate: 1,
formatters: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance of getting the default formatters registered in luma.gl? This verbose code is now in more and more examples...

This is a great timing, now that luma.gl is making a major release version so no fear of accidentally breaking apps.

@@ -108,17 +130,36 @@ export default class App extends PureComponent {
];
}

_renderStats() {
// TODO - too verbose, get more default styling from stats widget?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Any chance to get this merged back as defaults into probe.gl, this verbose code is now in more and more examples...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up PR.

@@ -0,0 +1,98 @@
import {Vector3} from 'math.gl';
import {CullingVolume, Plane} from '@math.gl/culling';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this different from the Tile3DLayer? If so can we do any processing inside the loaders so they don't have to be different?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the example folder is temporary. Will merge i3s-3d-layer with tile-3d-layer in follow-up PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a temp change, to test i3s loading and rendering, will be removed and merged with 3d-tiles in followups.

@@ -4,12 +4,12 @@ import {Vector3} from 'math.gl';
import {COORDINATE_SYSTEM, CompositeLayer} from '@deck.gl/core';
import {SimpleMeshLayer} from '@deck.gl/mesh-layers';

import {I3STileset} from '@loaders.gl/i3s';
import {I3STileset3D} from '@loaders.gl/i3s';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is the plan to merge this tileset class with the other one?

We can e.g. create a @loaders.gl/category-3d-tiles if we need a common place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 3d-tiles cover both cesium 3d-tiles and i3s?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 3d-tiles cover both cesium 3d-tiles and i3s?

Assuming you mean the @loaders.gl/3d-tiles npm module, I am open to making a change here, and have it include multiple formats.

  • A strong reason to join them would be to avoid inefficiency / overhead of having so many npm modules).
  • A reason to keep them separate could be to make it easier for the various partners that help us maintain the different standards to make changes to their module without being affected by other modules. But since we are sharing traversal code anyway I am not sure this really helps.

If joining the modules, some considerations would be:

  • We do want a clear distinction between code that implements a certain tiled format (subdirectories for ./3d-tiles/, ./i3s/, ./potree/ etc). This would contain the various file format loaders, but also format specific things like styling support etc.
  • Clearly documented ./common/ code that is shared between formats (traversal/caching/request scheduling etc).

Of course we should also consider the opinions of contributors, e.g. if @loshjawrence would have concerns about a single module setup covering all tiled formats.

// For traditional replacement refinement only refine if all children are loaded.
// Empty tiles are exempt since it looks better if children stream in as they are loaded to fill the empty space.
const checkRefines =
!skipLevelOfDetail && tile.refine === TILE3D_REFINEMENT.REPLACE && tile.hasRenderContent;
Copy link
Collaborator

@loshjawrence loshjawrence Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing references to skipLevelOfDetail in this pr or part 2 since we would need to have loaders generate gpu commands so that it would look ok during loading.

get hasChildren() {
// this.children are Tile3DHeader objects with content fetched from server
// this._header.children are children of this tile which are not yet fetched
return this.children.length > 0 || (this._header.children && this.children.length > 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just be return this.children.length > 0;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it cannot work well with i3s tiles, the i3s tile doesn't include the tree structure in tileset, so loaders.gl needs to keep fetching each unfetched tile node during the traversal. So if an i3s tile node is already fetched tile._header.children will indicate if this tile has children or not. If loaders.gl continue fetching this tile's children, then whenever the child node is fetched, it will be constructed as Tile3DHeader object and added to tile.children.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explain this in comment?

@xintongxia xintongxia mentioned this pull request Dec 2, 2019
28 tasks
@@ -52,10 +52,19 @@ export default class RequestScheduler {
return Promise.resolve(handle);
}

// dedupe
const existingReq = this.requestQueue.find(req => req.handle === handle);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[WIP] use 3d-tiles traversal

Refactor 3d tile traversal

remove unused code

address comments

address comments

add debugging console

Dedupe tile requests

enable debuggging

Cleanup 3d-tiles traversal

[WIP] use 3d-tiles traversal

Refactor 3d tile traversal

remove unused code

address comments

address comments

add debugging console

Use smaller bounding sphere

Dedupe tile requests

enable debuggging

Add more examples

Add stack dedupe and cancel frame update
@xintongxia
Copy link
Author

Will do followup PR to address comments

@xintongxia xintongxia merged commit 994c463 into master Dec 12, 2019
@xintongxia xintongxia deleted the xx/i3s branch December 12, 2019 01:46
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.

4 participants