I want to load multiple wmts layers, and I tried modifying MI_CesiumThreeOverlayAndClipping. When I added the eighth MaterialLayers, the material compilation failed.
Hi @newpeople123 ,
Unfortunately, Unreal’s materials can only support so many textures. You’ll probably need to find a way to reduce the number of overlays required, perhaps by combining multiple layers together on the server side.
janine
December 18, 2024, 6:23pm
3
Just a drive-by comment, but this old Github issue might be relevant:
opened 09:38PM - 10 Jun 21 UTC
enhancement
performance
In the CesiumGlTFFunction and CesiumRasterOverlay material functions, we use a l… ot of Texture Sample nodes, which means that we are by default at 10/16 texture samplers for the M_CesiumOverlay material and 12/16 for M_CesiumOverlayWater. This definitely limits future materials that we or users may need to create.
If we set the Sampler Source on each Texture Sample to Shared:Wrap, we can significantly reduce the texture samplers to 3/16 for the overlay material and 4/16 for the water material.

From my preliminary testing, it hasn't changed the appearance of tilesets at all. In addition, it doesn't look like there are really known issues that arise from doing this. One user in [this thread](https://forums.unrealengine.com/t/downsides-to-using-shared-texture-sampler-source/89759#post967276) posted that Shared: Wrap doesn't work with Metal, which may cause trouble for mac builds. We should definitely test this out, and figure out if there are any other drawbacks of changing the Sampler Source to this. If not, this would be a helpful change.
If you want to test this out, I've set the materials to use Shared: Wrap in the[ reduce-tex-samples branch](https://github.com/CesiumGS/cesium-unreal/tree/reduce-tex-samples).
@newpeople123 If you try changing these sampler settings, does that help with your issue?
Thank you for your reply.I know this, but as the comment suggests, will the modification result in unknown errors?