Conversation
…he intersection succeeded
Also reuse the loading queue from the normal view tile selection Seems to have a significant speed improvement. My tests went 6-8 seconds to 3 secs.
|
I believe this is now ready to merge. However, because I've now done a fair bit of work on it, it's probably a good idea to get someone else's eyes on it first. |
j9liu
left a comment
There was a problem hiding this comment.
@kring this looks good to me! I didn't look over the tests or the algorithm too closely, but I'm sure I can verify correctness when I look at the corresponding Unity / Unreal PRs.
Most of my comments are doc / understanding related. I'm pushing a commit that addresses some of these, but I wanted to leave some up for input. But none of these have to hold up the PR before the release!
| * {@link SampleHeightResult::positions} is unchanged from the original input | ||
| * height. | ||
| */ | ||
| std::vector<bool> heightSampled; |
There was a problem hiding this comment.
When I read heightSampled my brain first thinks "oh, this is the height that was sampled," instead of "this was whether the sample actually happened." What do you think of this alternative?
| std::vector<bool> heightSampled; | |
| std::vector<bool> sampleSuccessful; |
There was a problem hiding this comment.
Actually I kind of prefer sampleSuccess more, since that's briefer.
Other suggestions I could think of are
successfulSamplesuccessfullySampledheightWasSampledwasHeightChanged/heightWasChanged.
| * @brief The positions and sampled heights. | ||
| * | ||
| * The longitudes and latitudes will match the values at the same index in the | ||
| * original input positions. Each height will either be the height sampled | ||
| * from the tileset at that position, or the original input height if the | ||
| * height could not be sampled. To determine which, look at the value of | ||
| * {@link SampleHeightResult::heightSampled} at the same index. |
There was a problem hiding this comment.
| * @brief The positions and sampled heights. | |
| * | |
| * The longitudes and latitudes will match the values at the same index in the | |
| * original input positions. Each height will either be the height sampled | |
| * from the tileset at that position, or the original input height if the | |
| * height could not be sampled. To determine which, look at the value of | |
| * {@link SampleHeightResult::heightSampled} at the same index. | |
| * @brief The positions and their sampled heights. | |
| * | |
| * For each resulting position, its longitude and latitude values will match | |
| * values from its input. Its height will either be the height sampled from | |
| * the tileset at that position, or the original input height if the sample | |
| * was unsuccessful. To determine which, look at the value of | |
| * {@link SampleHeightResult::sampleSuccessful} at the same index. |
Cesium3DTilesSelection/include/Cesium3DTilesSelection/SampleHeightResult.h
Outdated
Show resolved
Hide resolved
|
One thing I noticed while testing CesiumGS/cesium-unreal#1421: if the tileset is invalid (e.g., invalid ion asset ID), it never completes the async action, and the |
Co-authored-by: Janine Liu <32226860+j9liu@users.noreply.github.com>
Co-authored-by: Janine Liu <32226860+j9liu@users.noreply.github.com>
Co-authored-by: Janine Liu <32226860+j9liu@users.noreply.github.com>
And add documentation for createLatentChildrenIfNecessary.
I believe I fixed this in this commit, but cesium-unreal wasn't updated to use it yet: I'll write a test in cesium-native for this case, though. |
|
Thanks for the review @j9liu, this should be ready for another look. |
|
Looks great, thanks @kring ! 😄 |
Adds new functionality to
Tilesetto enable terrain height queries.Builds on previous cesium-native work for ray / triangle and ray / gltf intersections.
Approach
To find the height at a latitude / longitude, we must first load the terrain data for this location, construct a ray at that coordinate pointing towards the center of the earth, then intersect all the content in the tile, using the closest hit as our discovered height.
Height queries can happen for tiles not selected from a camera, so we introduce a parallel tile loading strategy that builds on the same system. Just as we use a camera frustum for
_visitTileIfNeeded, we use our new height query requests and callvisitHeightRequests. This discovers which tiles are needed to load and adds them to the same priority queues that the camera-based tiles go to.Once all relevant tiles are loaded, we ray intersect against all of their contents.
Fixes #636
TO DO
addTileToLoadQueuefor tiles added from query traversalfindCandidateTilesfor additive-refined tilesets.Support for instanced modelsWrote an issue: Add support for height queries against instanced models #948Return all heights, not just the highestNot urgent at this time.