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

Multiple raster overlays cleanup #495

Merged
merged 2 commits into from
Oct 19, 2023
Merged

Conversation

lilleyse
Copy link
Contributor

As I was integrating multiple raster overlays (#492) into tileset material nodes (#406) I realized it would be much simpler to treat glTF base color textures and raster overlays as separate things instead of all being treated as base color textures.

The main change is in cesium.mdl where cesium_imagery_layer_resolver is responsible for blending imagery layers together and cesium_material is responsible for blending the final imagery layer color with the glTF base color texture. As a result cesium_material is no longer an exact copy of gltf_material, but does some simple calculations first.

In the case where there's a single imagery layer performance should still be good because it skips cesium_imagery_layer_resolver.

Copy link
Contributor Author

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

I pointed out some bug fixes that were included in this PR

Comment on lines +59 to 60
return fabricMesh.material != nullptr && fabricMesh.material->getMaterialDefinition().hasBaseColorTexture() &&
fabricMesh.materialInfo.baseColorTexture.has_value();
Copy link
Contributor Author

@lilleyse lilleyse Oct 18, 2023

Choose a reason for hiding this comment

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

Bug fix. The nullptr check prevents against a crash if you're using a custom tileset material in #406 but omniverse can't locate it (the full explanation for why this happens is a bit longer).

@@ -410,7 +407,7 @@ void FabricMaterial::setTextureValues(
const TextureInfo& textureInfo,
uint64_t texcoordIndex) {

if (texcoordIndex >= FabricTokens::MAX_TEXTURE_LAYER_COUNT) {
if (texcoordIndex >= FabricTokens::MAX_PRIMVAR_ST_COUNT) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug fix, was using the wrong constant.

Comment on lines +58 to +73
gltf_texture_lookup_value imagery_layer_0 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_1 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_2 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_3 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_4 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_5 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_6 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_7 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_8 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_9 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_10 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_11 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_12 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_13 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_14 = gltf_texture_lookup(),
gltf_texture_lookup_value imagery_layer_15 = gltf_texture_lookup()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should actually by gltf_texture_lookup_value(). It's harmless for now, but I fixed it on a different branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh and I forgot to mention in the PR description, eAsset arrays don't seem to work in Fabric which is why each texture is its own entry instead of gltf_texture_lookup_value[16]

Copy link
Contributor

@corybarr corybarr left a comment

Choose a reason for hiding this comment

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

I haven't spent much time with OV materials yet, but this all makes sense and LGTM.

@lilleyse lilleyse merged commit 9873a23 into main Oct 19, 2023
3 checks passed
@lilleyse lilleyse deleted the multiple-raster-overlays-cleanup branch October 19, 2023 22:57
@lilleyse lilleyse mentioned this pull request Nov 9, 2023
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.

2 participants