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

3d tiles, partial loading of tile trees #3237

Merged
merged 22 commits into from Dec 8, 2015

Conversation

e-andersson
Copy link
Contributor

As discussed with @pjcozzi and @lilleyse here are some changes that implement partial loading of tile trees and fix the problem of empty tiles (tiles.json-pointing tiles) being rendered.

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 23, 2015

@lilleyse can you please do a first round of review on this? Then I'll do a quick look when you think it is ready.

@lilleyse
Copy link
Contributor

@e-andersson I would like to make some minor changes to the code, could you give me commit access to your fork?

@e-andersson
Copy link
Contributor Author

@lilleyse Sure, done!

@lilleyse
Copy link
Contributor

Thanks!

@lilleyse
Copy link
Contributor

Easier to view my comments inline with the code here

@lilleyse
Copy link
Contributor

Overall most of the changes are organization related, with some miscellaneous cleanup. Please let me know if I overlooked something.

@@ -136,7 +150,10 @@ define([
var type = url.substring(url.lastIndexOf('.') + 1);
var contentFactory = Cesium3DTileContentProviderFactory[type];

if (defined(contentFactory)) {
if (type === 'json') {
Copy link
Member

Choose a reason for hiding this comment

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

This may be outside the scope of this PR, but would /type/i.test('json') be better here, or is lowercase guaranteed? Also, this looks like it is grabbing the type based on the file extension in the url. That's generally bad practice and we should be using content types. Though I imagine that's a spec-related decision.

Copy link
Contributor

Choose a reason for hiding this comment

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

We removed content.type: CesiumGS/3d-tiles#5

We can add it back, but it is redundant, except for the cases where the file wouldn't have an extension. Can you point me to something that showing this is the right practice in this context - as opposed to a generic web request? It feels like overkill.

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to the actual web response content-type header. However, looking at this some more I think it's okay as long as the spec states that urls must end in the correct extension. Terrain does something similar and requires all tiles end in .terrain.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeap, thanks for looking into it.

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2015

@lilleyse is this ready for me to look at?

@lilleyse
Copy link
Contributor

@pjcozzi Yes this is ready.

@pjcozzi pjcozzi mentioned this pull request Nov 24, 2015
@@ -124,6 +124,20 @@ define([
/**
* DOC_TBA
*
* @readonly
*/
this.hasSubtree = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

The hasSubtree and subtreeLoading terminology may be confusing since all non-leaf tiles have sub-trees. Maybe these should be isTileset and tilesetLoading?

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2015

Sorry, more terminology, please call 3D tile tree a tileset throughout.

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2015

@e-andersson if you can give me commit access to your fork, I will make trivial changes without bothering you?

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2015

@e-andersson this looks good, thanks again! Just those minor terminology changes. I will also reformat a few things to make it closer to the Cesium conventions, but I can do that after we merge.

@lilleyse please cover all this possible cases (e.g., additive and replacement refinement) when you add tests.

@e-andersson
Copy link
Contributor Author

Thanks @pjcozzi. I've given you access to my fork now, feel free to make those changes.
Just a note on isTileset -- doesn't isTileset make it look like we're talking about an actual Cesium3DTileset? Agreed though that subtree is more confusing.

@@ -124,6 +124,20 @@ define([
/**
* DOC_TBA
*
* @readonly
*/
this.hasTilesetContent = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

These names are perhaps slightly better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, looks a bit clearer to me!

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2015

Just those comments. The approach is all good, we just need to finalize the corner case details for the spec.

@e-andersson
Copy link
Contributor Author

@pjcozzi I wasn't very clear about the state of this. I'm working on a few more things at the moment, will get back soon when it's ready for review.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 1, 2015

OK, sounds good.

@e-andersson
Copy link
Contributor Author

@pjcozzi Now when we've decided to not allow tileset content tiles with children, it seems nested tileset content tiles don't make sense anymore. Any tiles.json-in-tiles.json chain will be equivalent to just one tiles.json chain.

However, thinking about tileset loading strategies, I can see a use case where there is an all-encompassing root, that has as its children tilesets covering a large part of the earth. We wouldn't want to iterate over thousands of children. If we were to let tileset content tiles have children (in addition to its external root), it would cover this use case, but not in a very clean way.
Other possible options to deal with this use case:

  • Separate tree structure that helps decide when to load Cesium3DTilesets
  • Allow tiles.json that specify multiple children in top object, instead of a single root. A tile with this type of content wouldn't map well to a regular tile though.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 2, 2015

@e-andersson are you talking about the "tileset of tilesets" case where, for example, we may have a tileset for each city, but we don't want to load lots of tilesets just to meaningless loop over most of them since their projected screen-space error would be so small?

I think the right approach is to build a spatial data structure between each tileset (think of them as leaf nodes) and the root "tileset of tilesets" using basically empty interior nodes (with external tiles.json as desired). This is the same, for example, as a quadtree that only has content in leaf nodes - using the quad tree is more efficient than just making all the leaf nodes a child of the root.

@e-andersson
Copy link
Contributor Author

@pjcozzi Yes, that's what I mean.

The approach you describe is pretty much what we over here have so far talked about as the most promising solution. In order to make a tileset of tilesets tree (quad or other), it seems that tiles with empty content need to be allowed by the specification. Currently the tiles schema says that a content.url is required, but perhaps that could be optional and if not given it would indicate an empty tile whose purpose is to let the tree branch out (thanks to its children).

I made a simple sketch of how I imagine such a tileset of tilesets would look, assuming empty content tiles are allowed. This is perhaps getting slightly off-topic for this pull request, but it would be nice to know this case will be supported within the current tileset/tiles specification before finishing.

tileset_of_tilesets

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 3, 2015

Wow, nice diagram. content.url is required, but content is optional. From the spec:

content is optional. When it is not defined, the tile's bounding volume is still used for culling (see Grids).

(Also, there is no "required" : true in the schema).

I believe this works for your use case (I have the same exact use case in mind). Do you agree?

I'm pretty sure I tested this in Cesium and I also added it to our list of unit tests to add (thanks for the reminder). Let me know if you run into an issue.

@e-andersson
Copy link
Contributor Author

Thanks :-)

Ah, I looked in the wrong place, didn't occur to me to check whether content itself was required or not. Great, then I don't see any remaining issue. Will just change a few things back and then ping you when this PR is ready. Thanks for clarifying things!

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 3, 2015

Sounds great!

@e-andersson
Copy link
Contributor Author

@pjcozzi This is ready for review now. Sorry it took a while -- I started exploring other ways of structuring the code and the algorithm but in the end it didn't turn out well.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 7, 2015

Thanks @e-andersson! I am in a conference all day so I will look at this tomorrow.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 8, 2015

@lilleyse any comments?

@@ -381,7 +406,9 @@ define([
}

if (root.isContentUnloaded()) {
if (outOfCore) {
if (root.hasTilesetContent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this shouldn't be:

if (outOfCore) {
    if (root.hasTilesetContent) {
        selectTileWithTilesetContent(tiles3D, selectedTiles, root, fullyVisible, frameState, true);
    } else {
        requestContent(tiles3D, root);
    }
}

When outOfCore is false, the tileset is rendered for picking and we want to render the same exact commands as the previous pass without making/processing any requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, submitted new pull request to fix this.

@lilleyse
Copy link
Contributor

lilleyse commented Dec 8, 2015

Nothing major to add, but I do wonder if Tileset3DTileContentProvider can be fleshed out more to include some of logic that happens during the traversal. However I'm not completely sure what this would look like.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 8, 2015

@lilleyse thanks, perhaps that is something that will become obvious to you when you write unit tests.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 8, 2015

Thanks again @e-andersson! I made a few style tweaks to make things consistent with the Cesium codebase (we are working on a guide in #3312 ). My only outstanding question is #3237 (comment).

I am going to merge this since it will help @lilleyse write unit tests. Open another PR if we need to tweak this.

pjcozzi added a commit that referenced this pull request Dec 8, 2015
3d tiles, partial loading of tile trees
@pjcozzi pjcozzi merged commit 34ae325 into CesiumGS:3d-tiles Dec 8, 2015
@pjcozzi pjcozzi deleted the 3d-tiles branch December 8, 2015 21:30
@e-andersson
Copy link
Contributor Author

@lilleyse I was thinking about that too, and tried a few things in that direction but didn't find a good, clean way of doing it. I'm available for discussion of other options if needed!

@pjcozzi Question addressed, new PR submitted. Hadn't seen that coding guide until now, will use from now on!

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 9, 2015

@e-andersson you haven't seen the coding guide yet because we just finished the draft yesterday. :)

We also just wrote a Testing Guide. Once we finish the initial 3D Tiles tests (#3177), we'll ask that all new pull requests include tests.

@e-andersson
Copy link
Contributor Author

That explains it :)
Looking forward to seeing the 3D tileset tests.

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.

None yet

4 participants