-
Notifications
You must be signed in to change notification settings - Fork 303
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 fixes and perf improvements #2143
Conversation
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.
This review does not treat the solution implemented (replacing C3DTBoundingVolume by sphere) and if this is actually working.. but is more about the code in itself.
What could I do to check if the solution is working ?
* Bounding Volume is a sphere. | ||
* @property {String} initialVolumeType - the initial volume type to be able to dissociate spheres | ||
* and regions if needed since both are converted to spheres (one of {@link C3DTilesBoundingVolumeTypes}) | ||
* @property {THREE.Box3|THREE.Sphere} volume - The 3D bounding volume created. Can be a THREE.Box3 for bounding volumes |
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 think it's a poor pattern to store in a single variable different type of object (volume
) then to use another variable (here initialVolumeType
) to know how to manipulate volume
.. (btw you could use instanceof instead of initialVolumeType)
you could create a wrapper abstract class called Volume
implementing a method isVisible(camera, tileMatrixWorld)
then specifying SphereVolume
and BoxVolume
(class extending Volume
) the specific behavior.
you could also put two attributes in C3DTBoundingVolume
instead of volume
one called box
and the other one sphere
which is the solution I rather, since a C3DTBoundingVolume
could have the both and it avoids to create an abstract class
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.
The last pattern was the previously used pattern. However, if we choose this one I would keep the initialVolumeType
to be able to know if the sphere comes from a bounding sphere or from a bounding region, in case it may be useful for itowns' users in some way. The second pattern is also interesting, I actually thought about it when implementing this. I don't have time to implement it right now but I'll come back to it soon.
Hi @valentinMachado , thanks for your review and sorry for the late response.
You can use a 3D Tiles dataset with bounding volumes of region type to test if it works. The only open source one and available online that I know is this one. |
d9bc50b
to
564f61d
Compare
Except from the conflict that should be easy to fix it's all good for me. Thanks ! |
fix(3dtiles): Fix a bug in 3d tiles bounding spheres subdivisions fix(3dtiles): Fix 3D tiles debug bounding spheres BREAKING CHANGE: Remove region, box and sphere properties of C3DTBoundingVolume. They have been replaced by volume property which contains a THREE.Box3 (for box) or a THREE.Sphere (for sphere or region). Initial bounding volume type can be retrieved with the initialVolumeType property.
564f61d
to
f888d36
Compare
Some 3D tiles fixes:
Perf improvement:
After the PR, we spend most of the time in parsing and preparing for rendering:
I also tried to implement a conversion to threejs' OBB and to implement a culling algorithm on OBB (SSE computation for OBB is easy) but didn't succeed completely (can be seen on the following branch). Another way would have been to improve OBB.setFromExtent which is the culprit but I haven't found another way of implementing it yet. Propositions are welcome :)
BREAKING CHANGE: Remove region, box and sphere properties of C3DTBoundingVolume. They have been replaced by volume property which contains a THREE.Box3 (for box) or a THREE.Sphere (for sphere or region). Initial bounding volume type can be retrieved with the initialVolumeType property.