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

Replace InMemoryAssetResolver with DynamicTextureProvider #252

Merged
merged 11 commits into from
Apr 27, 2023

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Mar 29, 2023

Fixes #116

Removes InMemoryAssetResolver and uses Omniverse's built-in DynamicTextureProvider instead. This has several benefits:

  • No longer need to convert raw pixels to BMP
  • Textures now work when Cesium for Omniverse is first installed, without a restart 1
  • Compressed textures and mipmaps are supported in DynamicTextureProvider. That can be a follow up PR.
  • Pixel data can be swapped out dynamically. This means we don't need to create a new material when higher detail imagery comes in. Going a step further, this allows us to do basic material pooling which could significantly improve performance. I haven't actually tested this yet, it will be a follow up PR.
  • I no longer see cyan flashes (texture loading) for 3D Tiles input. Red flashes still happen, but that's expected.
  • Removed /rtx-transient/resourcemanager/enableTextureStreaming = false workaround from InMemoryAssetResolver plugin not being called #95

This doesn't fix the crashes / hangs we've noticed. At least not all of them. I can still trigger hangs by reloading agi.usda repeatedly.

One potential blocker is that each time a texture is loaded a warning gets printed. I reached out to the Nvidia team about this.

2023-03-29 19:50:32  [Warning] [omni.hydra] Material parameter 'tex' was assigned an incompatible texture: 'dynamic://imagery_ion_2__11718102_184221417_4827478_456288989__11717949_310164846_4827677_90915967'

image

To do:

  • Fix Windows CI

Footnotes

  1. Though a restart is still required to register Cesium USD schemas

Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One open question.

@@ -78,6 +78,7 @@ set(CARB_ROOT "${NVIDIA_BUILD_DIR}/target-deps/carb_sdk_plugins")
set(KIT_SDK_ROOT "${NVIDIA_BUILD_DIR}/target-deps/kit-sdk")
set(PYBIND11_ROOT "${NVIDIA_BUILD_DIR}/target-deps/pybind11")
set(CUDA_ROOT "${NVIDIA_BUILD_DIR}/target-deps/cuda")
set(RTX_PLUGINS_ROOT "${NVIDIA_BUILD_DIR}/target-deps/rtx_plugins")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, please raise this up to Nvidia so we can understand if this is an expected dependency.

Comment on lines +27 to +29
auto& referenceCount = accessor->second->_referenceCount;
referenceCount--;
if (referenceCount == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as found is held it blocks other threads, correct? I'm concerned about if there's a case where we could run into a situation where reference count could go negative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe accessor acts as a lock guard, so we shouldn't see any race conditions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. This is good to go once you fix the Windows builds. I'll give it a quick once over when that's done.

Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline. Blocking this due to the perceived performance issues and warning spam. We'll revisit this with either the next Kit release or if we get a workaround.

@lilleyse
Copy link
Contributor Author

This PR doesn't seem to fix the blue dots artifact that shows up in Create when a material is loaded. Interestingly this doesn't happen in cesium.omniverse.app.kit.

blue-flickers

This is different from the cyan placeholder when loading textures, which is fixed in this PR.

Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go.

@weegeekps weegeekps merged commit 740b561 into main Apr 27, 2023
3 checks passed
@weegeekps weegeekps deleted the dynamic-texture-provider branch April 27, 2023 20:39
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

Successfully merging this pull request may close these issues.

Replace InMemoryAssetResolver with omni.ui.DynamicTextureProvider
2 participants