Skip to content

Commit

Permalink
Changes to support photorealistic 3D tiles in ion
Browse files Browse the repository at this point in the history
  • Loading branch information
weegeekps committed Sep 28, 2023
1 parent bdcd339 commit 8f63fda
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
Tokens as CesiumTokens,
)

ION_ACCESS_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZjM4NjgzNC01Nzg5LTQyMjAtYmYxMC0yNGY2MGEzOGViMGUiLCJpZCI6MjU5LCJpYXQiOjE2OTM1Nzg5MTN9.-J367LOCiroxRBoH9eKhgssEd2Wk_IoqOxROfy-dPjs" # noqa: E501
GOOGLE_3D_TILES_URL = "https://tile.googleapis.com/v1/3dtiles/root.json?key=AIzaSyBTr9BGnwtJmS0sL86iTb6QhdJlnkAFLoE"
ION_ACCESS_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4MTkxNmE1Ni03NzEyLTRmNzYtODcwYi1mOTZkM2RiNDFhYmUiLCJpZCI6MTI5LCJpYXQiOjE2OTU4NDQ0MTR9.r-ZnPKqCxRk9tXBDNYaY1rHHm6Fe4O-HMOJYVITe0do" # noqa: E501
GOOGLE_3D_TILES_ION_ID = 823

CESIUM_DATA_PRIM_PATH = "/Cesium"
CESIUM_GEOREFERENCE_PRIM_PATH = "/CesiumGeoreference"
Expand Down Expand Up @@ -251,8 +251,7 @@ def _create_tileset_google() -> str:
tileset_path = omni.usd.get_stage_next_free_path(stage, "/Google_3D_Tiles", False)
tileset = CesiumTileset.Define(stage, tileset_path)

tileset.GetUrlAttr().Set(GOOGLE_3D_TILES_URL)
tileset.GetSourceTypeAttr().Set(CesiumTokens.url)
tileset.GetIonAssetIdAttr().Set(GOOGLE_3D_TILES_ION_ID)

return tileset_path

Expand Down
29 changes: 13 additions & 16 deletions docs/release-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
This is the process we follow when releasing a new version of Cesium for Omniverse on GitHub.

1. [Release a new version of Cesium for Omniverse Samples](#releasing-a-new-version-of-cesium-for-omniverse-samples).
2. Update [`extension.py`](../../apps/exts/cesium.performance.app/cesium/performance/app/extension.py) in the Performance App with the latest public `ION_ACCESS_TOKEN`.
3. Make sure the latest commit in `main` is passing CI.
4. Download the latest build from S3. In the AWS management console (InternalServices AWS account), go to the bucket [`cesium-builds/cesium-omniverse/main`](https://s3.console.aws.amazon.com/s3/buckets/cesium-builds?region=us-east-1&prefix=cesium-omniverse/main/&showversions=false), find the appropriate date and commit hash to download the CentOS and Windows zip files (e.g. `CesiumForOmniverse-Linux-xxxxxxx.zip` and `CesiumForOmniverse-Windows-xxxxxxx.zip`)
5. Verify that the Linux package loads in USD Composer (see instructions below).
6. Verify that the Windows package loads in USD Composer (see instructions below).
7. Update the project `VERSION` in [CMakeLists.txt](../../CMakeLists.txt).
8. Update the extension `version` in [extension.toml](../../exts/cesium.omniverse/config/extension.toml). This should be the same version as above.
9. Update [`CHANGES.md`](CHANGES.md).
9. Update [`CHANGES.md`](../../CHANGES.md).
10. Update `ION_ACCESS_TOKEN` and `GOOGLE_3D_TILES_URL` in `cesium.performance.app` using the newly generated keys.
11. Create a branch, e.g. `git checkout -b release-0.0.0`.
12. Commit the changes, e.g. `git commit -am "0.0.0 release"`.
Expand All @@ -30,21 +31,17 @@ This is the process we follow when releasing a new version of Cesium for Omniver
* The name of the token should match "Cesium for Omniverse Samples vX.X.X - Delete on April 1st, 2023" where the version is the same as the Cesium for Omniverse release and the expiry date is two months later than present.
* The scope of the token should be "assets:read" for all assets.
2. Replace the `cesium:projectDefaultIonAccessToken` property in each `.usda` file with the new access token.
3. Create a new Google Maps API Key in the [Cesium account](https://console.cloud.google.com/google/maps-apis/credentials?project=threed-tiles-api-testing).
* The name of the key should match "Cesium for Omniverse Samples vX.X.X - Delete on April 1st, 2023" where the version is the same as the Cesium for Omniverse release and the expiry date is two months later than present.
* The key should be restricted to the Map Tiles API.
4. For each `.usda` file using the Google 3D Tiles API, replace the key in the `cesium:url` property with the new key.
5. Verify that all the USD files load in Cesium for Omniverse.
6. Update `CHANGES.md`.
7. Commit the changes, e.g. `git commit -am "0.0.0 release"`.
8. Push the commit, e.g. `git push origin main`.
9. Tag the release, e.g. `git tag -a v0.0.0 -m "0.0.0 release"`.
10. Push the tag, e.g. `git push origin v0.0.0`.
11. Download the repo as a zip file.
12. Extract the zip file.
13. Rename the extracted folder, e.g. rename `cesium-omniverse-samples-main` to `CesiumOmniverseSamples-v0.0.0`.
14. Create a zip file of the folder
15. Create a new release on GitHub: https://github.com/CesiumGS/cesium-omniverse-samples/releases/new.
3. Verify that all the USD files load in Cesium for Omniverse.
4. Update `CHANGES.md`.
5. Commit the changes, e.g. `git commit -am "0.0.0 release"`.
6. Push the commit, e.g. `git push origin main`.
7. Tag the release, e.g. `git tag -a v0.0.0 -m "0.0.0 release"`.
8. Push the tag, e.g. `git push origin v0.0.0`.
9. Download the repo as a zip file.
10. Extract the zip file.
11. Rename the extracted folder, e.g. rename `cesium-omniverse-samples-main` to `CesiumOmniverseSamples-v0.0.0`.
12. Create a zip file of the folder
13. Create a new release on GitHub: https://github.com/CesiumGS/cesium-omniverse-samples/releases/new.
* Choose the new tag.
* Copy the changelog into the description. Follow the format used in previous releases.
* Upload the zip file.
Expand Down
9 changes: 9 additions & 0 deletions exts/cesium.omniverse/cesium/omniverse/ui/quick_add_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def _add_blank_button_clicked():
add_blank_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_BLANK_ASSET")
app.get_app().get_message_bus_event_stream().push(add_blank_asset_event, payload=asset_to_add.to_dict())

def _photorealistic_tiles_button_clicked(self):
self._add_ion_assets(AssetToAdd("Google Photorealistic 3D Tiles", 823))

def _cwt_bing_maps_button_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium World Terrain", 1, "Bing Maps Aerial imagery", 2))

Expand Down Expand Up @@ -92,6 +95,12 @@ def _build_ui(self):
style=CesiumOmniverseUiStyles.quick_add_section_label,
height=LABEL_HEIGHT,
)
ui.Button(
"Google Photorealistic 3D Tiles",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._photorealistic_tiles_button_clicked,
)
ui.Button(
"Cesium World Terrain + Bing Maps Aerial imagery",
style=CesiumOmniverseUiStyles.quick_add_button,
Expand Down
9 changes: 6 additions & 3 deletions src/core/src/CesiumIonSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ void CesiumIonSession::connect() {
this->_asyncSystem,
this->_pAssetAccessor,
"Cesium for Omniverse",
413,
11,
"/cesium-for-omniverse/oauth2/callback",
{"assets:list", "assets:read", "profile:read", "tokens:read", "tokens:write", "geocode"},
[this](const std::string& url) {
// NOTE: We open the browser in the Python code. Check in the sign in widget's on_update_frame function.
this->_authorizeUrl = url;
})
},
"https://api.ion-development.cesium.com/",
"https://ion-development.cesium.com/oauth")
.thenInMainThread([this](CesiumIonClient::Connection&& connection) {
this->_isConnecting = false;
this->_connection = std::move(connection);
Expand Down Expand Up @@ -82,7 +84,8 @@ void CesiumIonSession::resume() {

this->_isResuming = true;

this->_connection = Connection(this->_asyncSystem, this->_pAssetAccessor, userAccessToken);
this->_connection = Connection(
this->_asyncSystem, this->_pAssetAccessor, userAccessToken, "https://api.ion-development.cesium.com/");

// Verify that the connection actually works.
this->_connection.value()
Expand Down
11 changes: 8 additions & 3 deletions src/core/src/OmniTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,11 @@ void OmniTileset::reload() {
_tileset = std::make_unique<Cesium3DTilesSelection::Tileset>(externals, url, options);
} else if (!ionAccessToken.has_value()) {
// This happens when adding a blank tileset.
_tileset = std::make_unique<Cesium3DTilesSelection::Tileset>(externals, 0, "", options);
_tileset = std::make_unique<Cesium3DTilesSelection::Tileset>(
externals, 0, "", options, "https://api.ion-development.cesium.com/");
} else {
_tileset = std::make_unique<Cesium3DTilesSelection::Tileset>(
externals, ionAssetId, ionAccessToken.value().token, options);
externals, ionAssetId, ionAccessToken.value().token, options, "https://api.ion-development.cesium.com/");
}

// Add imagery
Expand Down Expand Up @@ -387,7 +388,11 @@ void OmniTileset::addImageryIon(const pxr::SdfPath& imageryPath) {
// The name passed to IonRasterOverlay needs to uniquely identify this imagery otherwise texture caching may break
const auto uniqueName = fmt::format("imagery_ion_{}", imageryIonAssetId);
const auto ionRasterOverlay = new Cesium3DTilesSelection::IonRasterOverlay(
uniqueName, imageryIonAssetId, imageryIonAccessToken.value().token, options);
uniqueName,
imageryIonAssetId,
imageryIonAccessToken.value().token,
options,
"https://api.ion-development.cesium.com/");
_tileset->getOverlays().add(ionRasterOverlay);
}

Expand Down

0 comments on commit 8f63fda

Please sign in to comment.