Material Performance - Should I avoid math on Texture Coordinates?

So I read in the UE5 docs that doing math on a material’s Texture Coordinates (such as tiling a texture) can slow performance and potentially cause artifacts, especially on mobile. The fix Epic recommends for UE5 is to use the Customized UV inputs on the main material node instead, to do the math on the vertex shader. Unfortunately, Customized UV inputs do not appear in UEFN. Customized UVs in Unreal Engine Materials | Unreal Engine 5.3 Documentation

*Edit : @BradHB3D pointed out that Customized UVs can be turned on in the Material details.

In my maps, tiling my textures using TextureCoordinate allows me to widely tweak and reuse each texture and material, which drastically lowers the number of textures files and materials in my project. Same with texture atlases. Does that performance boost offset the cost of Texture Coordinate math? I also animate materials using the Flipbook Node, which relies on TextureCoordinate.

From the docs:

" On mobile, any texture sample that manipulates the texture coordinates in any way takes a slow path. These are called dependent texture fetches. By using the customized UV inputs, you can still implement tiling or world space texture mapping while keeping all the texture fetches independent, which is the fast path.

Additionally, everything in the pixel shader on mobile is evaluated with half precision floats. This causes blocky looking textures and some other artifacts, when pixel shader math is done on texture coordinates. The Customized UV inputs however are done with full precision so they get around this problem. "

Would appreciate any advice! Thanks!

Use of TextureCoordinates is generally employed, and for the simple case of tiling textures, often the approach.

Keep in mind too that in Fortnite, many textures assume a static, default tiling rate (probably 1), and model UVs are scaled accordingly in the modelling DCC (based on grid snapping and / or world scale). You can observe this in both architectural models and static mesh props. This also is an important component in being able to re-use / swap TextureData assets across instances / pre-fabs

1 Like

I just happened to be in UEFN and did a quick test. As long as you set the number of customized UVs on the parent material, you should be able to expose the material level inputs.

That said, it’s generally for highly specific use cases. While I don’t have significant experience with mobile, I don’t remember any low quality spec branching for tiling. We just generally use the TextureCoord node.

1 Like

Thanks for the info! Omg I totally skimmed past the part in the UE docs that shows how to add Customized UVs to a material. :open_mouth: :laughing:I just didn’t see them by default and figured that it was another UE feature that didn’t make it from UEFN.

Interesting tip about FN meshes handling the tiling in the model UVs instead of in the material. I hadn’t noticed that.

Do you personally have any specialized cases where you do use Customized UVs?

Interesting tip about FN meshes handling the tiling in the model UVs instead of in the material. I hadn’t noticed that.

It’s a pretty common default strategy for ensuring uniform texel density. Some of the assets you may notice have UVs snapped to the normalized coordinate space, and may not always be world scale, and sometimes is non-uniform. Modular wall segments are good examples of this some times. And sometimes a mix of both strategies are employed.

An alternative is tri planar mapping, but that isn’t nearly as cheap, and has it’s own negative side effects.

I personally haven’t yet required the use of customized UVs myself (for high end platforms and virtual production)

1 Like

Good to know :+1: Thanks again for your insight :blush:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.