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

Add support for height queries against instanced models #948

Open
kring opened this issue Sep 13, 2024 · 1 comment
Open

Add support for height queries against instanced models #948

kring opened this issue Sep 13, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@kring
Copy link
Member

kring commented Sep 13, 2024

#783 adds support for querying heights from a tileset at a point. However, it reports a warning - and doesn't find intersections - when the position falls within a tile that uses EXT_mesh_gpu_instancing.

Implementing support for height queries against instanced models on CPU will not be very efficient. We'd probably have to compute a bounding box for each instance, test the ray against that, and then for each hit, test the ray against the instantiated triangles. A GPU solution is going to be much more performant, but that raises lots of new challenges in the platform-agnostic environment of cesium-native.

A hybrid solution might be viable. cesium-native finds and loads the tiles that need to be tested against the height query ray, but then hands it off to the "renderer" (i.e., Unreal, Unity, etc.) via some interface to determine the actual intersection point. Within game engines, we could implement this via rendering and reading the depth buffer (as CesiumJS does), or we could use the game engines' physics engines.

@kring kring added the enhancement New feature or request label Sep 13, 2024
@ZackOfAllTrades
Copy link
Contributor

I'm currently using https://github.com/madmann91/bvh to do this as I can't loop through every triangle. I delete the mesh data from the CesiumModel after it has been constructed to not duplicate data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants