-
Notifications
You must be signed in to change notification settings - Fork 281
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
feat(ImplicitTiling): add octree support #791
base: master
Are you sure you want to change the base?
feat(ImplicitTiling): add octree support #791
Conversation
@gkjohnson 3DTilesRendererJS/src/base/plugins/SUBTREELoader.js Lines 773 to 774 in 727a440
Indeed, it looks like the box is not subdvided: (example 3d-tiles-samples/1.1/SparseImplicitOctree/tileset.json ) |
What do you mean by this?
Looks like
The loop referenced adjusts the bounding box center and half-axes to describe the specific subdivided child. Note that the array for a bounding box is defined as 3 values for the center, and 3 values for each half-vector on each axis. Currently the loop for adjusting the bounds does two things - it adjusts the half axes and adjusts the bounding box center by each necessary axis. Currently the loop only iterates over two axes to adjust their scale and the center because a quad tree only splits along X and Y. So two things need to happen:
Hopefully that makes sense - let me know if anything is still unclear |
Thank you for the answer :D
It's bounding box, I'll modify it to have region then :) |
Yeah it's a little long - maybe a function called "isOctreeSubdivision" that returns true or false would make it more readable. Looks great! It would be nice to get parent bounds rendering at some point so we can see the full hierarchy a la #730. |
src/base/plugins/SUBTREELoader.js
Outdated
const axisOffset = i === 0 ? tile.__x : tile.__y; | ||
const axisOffset = i === 0 ? tile.__x : ( i === 1 ? tile.__y : tile.__z ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the comment above can be updated.
src/base/plugins/SUBTREELoader.js
Outdated
if ( tile.__implicitRoot.implicitTiling.subdivisionScheme === 'OCTREE' ) { | ||
|
||
const minZ = region[ 4 ]; | ||
const maxZ = region[ 5 ]; | ||
|
||
const sizeZ = ( maxZ - minZ ) / Math.pow( 2, tile.__level ); | ||
region[ 4 ] += tile.__z * sizeZ; | ||
region[ 5 ] = region[ 4 ] + sizeZ; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add some comments here, I think, regarding what this is adjusting and how.
src/base/plugins/SUBTREELoader.js
Outdated
const z = tile.__implicitRoot.implicitTiling.subdivisionScheme === 'OCTREE' ? | ||
2 * parentTile.__z + ( Math.floor( tile.__subtreeIdx / 4 ) % 2 ) : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly just setting z to "0" here would make all the octtree / quadtree logic "just work" even if we don't have conditions for the two tree types 🤔. Maybe worth making a comment for later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that the 0
value even matters, it could be whatever. In the case of a quadtree, the Z value is not used in any calculus and is called only at the url parsing, but there wont be a "z" coordinate in a quadtree url
Add octree support for implicitTiling.
TODO: