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 multiple raster overlays #492

Merged
merged 3 commits into from
Oct 17, 2023
Merged

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Oct 16, 2023

Fixes #84

Adds support for multiple raster overlays.

  • Works on untextured datasets like CWT and textured datasets like Google 3D Tiles
  • Works for geographic and web mercator projections and future projections (i.e. texcoord sets are handled correctly)
  • Works for raster overlays with alpha

This required changes in a few places:

  • FabricGeometry and FabricGeometryDefinition now handle texcoord sets in a generic way. There were a few places where the texcoord set was hardcoded to zero. This has been fixed. See related changes in GltfUtil.
  • FabricMaterial supports up to 10 texcoord sets and 16 textures per texture array. Excess texcoord sets and textures are ignored. When there's a single texture it constructs the same shader network as before, so no performance loss. When there's multiple textures it uses the new cesium_texture_array_lookup shader which is responsible for blending all the imagery layers together with a simple alpha over blend. See cesium.mdl.

Note that the changes to FabricGeometryDefinition and FabricMaterialDefinition affect pooling - i.e. geometries with the same number of texcoord sets will go to the same geometry pool and materials with the same number of base color textures will go the same material pool.

The main performance TODO is:

  • cesium_texture_array_lookup is hardcoded for 16 textures which is much higher than the common case. If we procedurally generate the .mdl based on how many textures are in use it could improve performance. Or we could just have 16 versions of cesium_texture_array_lookup 🤷.

Not supported yet:

  • Styling, such as controlling the translucency of imagery layers

Examples:

multiple.usda.zip
Washington DC (Web Mercator) above Sentinel II (geographic) above Bing Maps (Web Mercator, not visible)

image (11)

multiple-google.usda.zip
Washington DC (Web Meractor) above Google 3D Tiles (textured glTF)

image (12)

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.

Technically, this looks fine, but I question if this really solves the problem without controls regarding how much to blend and such. I'm going to approve but please consider that point. My gut is saying this doesn't actually solve the need.

@lilleyse
Copy link
Contributor Author

@weegeekps completely agree, I decided to save styling for a follow up PR

@lilleyse lilleyse enabled auto-merge October 17, 2023 17:15
@lilleyse lilleyse merged commit 9137f54 into main Oct 17, 2023
3 checks passed
@lilleyse lilleyse deleted the multiple-raster-overlays branch October 17, 2023 17:37
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.

Support for multiple raster overlays
2 participants