Add support for multiple raster overlays #492
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #84
Adds support for multiple raster overlays.
This required changes in a few places:
FabricGeometry
andFabricGeometryDefinition
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 inGltfUtil
.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 newcesium_texture_array_lookup
shader which is responsible for blending all the imagery layers together with a simple alpha over blend. Seecesium.mdl
.Note that the changes to
FabricGeometryDefinition
andFabricMaterialDefinition
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 ofcesium_texture_array_lookup
🤷.Not supported yet:
Examples:
multiple.usda.zip
Washington DC (Web Mercator) above Sentinel II (geographic) above Bing Maps (Web Mercator, not visible)
multiple-google.usda.zip
Washington DC (Web Meractor) above Google 3D Tiles (textured glTF)