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

Requests for additional 3D Tiles samples #64

Open
javagl opened this issue Jun 12, 2023 · 4 comments
Open

Requests for additional 3D Tiles samples #64

javagl opened this issue Jun 12, 2023 · 4 comments

Comments

@javagl
Copy link
Contributor

javagl commented Jun 12, 2023

This issue is intended for collecting high-level ideas about 3D Tiles samples that may be added here. Details about specific examples can be discussed in dedicated issues or the corresponding PRs.

(This issue is a replacement of CesiumGS/3d-tiles#562 , and the following list is based on this issue)

  • Simple "unit test" models for the major new features
  • Simple "unit test" models for the major types of models, e.g., photogrammetry, CAD, point clouds
  • "Integration test" models that combine prominent use cases such as per-texel metadata in photogrammetry, and MESHOPT-compressed point clouds
  • "Scalability test" model so developers can test their out of core algorithms
  • A double-headed quadtree (see Update and extend the implicit tiling examples 3d-tiles#512 (comment) )
  • Further examples of implicit tiling, maybe pointing out different combinations of available levels and subtree levels...?
  • A small sample with 3DTILES_bounding_volume_S2
  • Samples for the 'semantics' of metadata
  • More examples for the glTF Metadata extensions. For example, there could be an EXT_structural_metadata version of the current TilesetWithFullMetadata
@ghost
Copy link

ghost commented Jul 13, 2023

I would be keen to see the simple triangle hello world mentioned in the other issue. It would be good to see this triangle on the earth's surface through a transform property on its mesh.

@javagl
Copy link
Contributor Author

javagl commented Jul 13, 2023

Some further details may be helpful here.

Putting a single glTF asset (being the triangle or something else) into a tileset.json is trivial. (And I'm not saying that with the intention of being dismissive. There's a reason why I created most of the "Simple..." models in the glTF-Sample-Models repo. Such models are important for basic tests)

I could imagine that such a tileset could be used to convey some 3D-Tiles-specific ideas, though. Namely: How to position a certain model at a certain (longitude/latitude/height) position, taking all the GIS-specific coordinate transforms into account.

Much of this would probably be described in the corresponding README.md (simliar to how the BoundingBoxTests show the connection between glTF and 3D Tiles bounding volumes).

@ghost
Copy link

ghost commented Jul 13, 2023

I ask as I've been struggling for about a week to place a gltf asset at a specific lat long position.

I've calculated the ECEF coordinates using:
echo 12.257257 52.147453 100 | cs2cs +proj=latlong +datum=WGS84 +to +proj=geocent +datum=WGS84

I use this as the translation of the root node of the gltf (which contains a single mesh). I then use this, + the min/max bounds in the gltf to set a bounding volume (box).

I am currently using the following sandcastle setup to debug.

This will zoom to the right location, spam the console with messages telling me that the tile is visible, and the asset won't show up.

A example walking through how to do something like this would be helpful. Both my gltf and tileset pass their respective validators.

P.S: I haven't done any y-up to z-up transforms. The spec suggests cesium does this automatically after gltf defined transformations, which would break everything for me.

P.P.S: changing the translation to account for the transformation gave me results similar to this.

@javagl
Copy link
Contributor Author

javagl commented Jul 14, 2023

There are different options for where and how that "placement transform" could be applied.

For example: When applying your sandcastle to the TilesetWithDiscreteLOD, then it works fine: The model is properly displayed. In this tileset, the "placement" is accomplished with the transform of the root matrix of the tileset.

When applying the same sandcasttle to the MultipleContents sample, then the placement is off: The tileset does not define such a transform, causing it to basically be placed "at the center of the earth".

You can fix the placement at runtime in this case. For example, you could insert this in the sandcastle, after loading the tileset:

// Move the tileset to a certain position on the globe,
// and scale it up
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(
  Cesium.Cartesian3.fromDegrees(-75.152408, 39.9471, 1)
);
const scale = 15.0;
tileset.modelMatrix = Cesium.Matrix4.multiplyByUniformScale(
  transform,
  scale,
  new Cesium.Matrix4()
);

This will move the model (i.e. tileset and contents) to the specified position on the globe.


Another option would be to put the proper transform into the glTF asset itself. So instead of setting the transform of the root node of the tileset (as in the first example), you could put this transform matrix into the root node of the glTF (taking the different up-axes into account). But this approach could have a drawback: Imagine you had a glTF asset of a building. You could set the transform of the root node inside the glTF, so that the building appears at the right place on the globe. But if you then wanted to move this building to a different place on the globe, you would have to "cancel" the transform that it already has, and apply a new transform (inside the tileset JSON). So I'd usually consider it to be more flexible to have the glTF asset in a "neutral" state (at the origin, y-up), and do any placement either with the tileset JSON tile transforms, or manually at runtime by setting the modelMatrix of the tileset.

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

No branches or pull requests

1 participant