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

Consider setting texture sampler sources to Shared:Wrap #490

Open
argallegos opened this issue Jun 10, 2021 · 2 comments
Open

Consider setting texture sampler sources to Shared:Wrap #490

argallegos opened this issue Jun 10, 2021 · 2 comments
Labels
enhancement New feature or request performance Improvements to performance, including reductions in memory usage

Comments

@argallegos
Copy link
Contributor

In the CesiumGlTFFunction and CesiumRasterOverlay material functions, we use a lot 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.
image

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 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.

@argallegos argallegos added the enhancement New feature or request label Jun 10, 2021
@argallegos
Copy link
Contributor Author

Per conversation in stand up, the Gltf function will likely need to keep the sampler source as is, for tilesets with unconventional UV requirements. However, we can change the RasterOverlay function to use Shared: Wrap, which will still free up some texture samplers.

@kring kring added the performance Improvements to performance, including reductions in memory usage label May 31, 2022
@kring kring mentioned this issue May 31, 2022
30 tasks
@j9liu
Copy link
Contributor

j9liu commented May 6, 2024

While testing things, I noticed that our materials don't compile with "Forward Rendering" enabled in the project. It was due to exceeding the 16 sampler limit. But the recommended workaround to get more texture slots is to use the Shared:Wrap sampler, according to this thread: https://forums.unrealengine.com/t/sm5-errror-x4510-maximum-ps-5-0-sampler-register-index-16-exceeded/281091

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Improvements to performance, including reductions in memory usage
Projects
None yet
Development

No branches or pull requests

3 participants