Material texture scales (required for streaming) undefined when UV manipulation done on vertex shader

Hi, I’m having an issue where using a flipbook animation on an effect, the texture fails to stream in higher resolution mips. Using the debug view Optimization Viewmodes->Material Texture Scales I can see that the info is undefined, so presumably is falling back to assuming that the UV is in a 0-1 range rather than using a small part of the flipbook. I’ve tracked this down to manipulating the UVs in the vertex shader, either by using a vertex interpolator node or custom UVs, if the UVs are passed through directly it seems to work. Ideally we’d like to continue doing the UV work in the vertex shader, could you advise why the material texture scale calculation doesn’t work in this case?

I’ve attached screenshots showing a simple material demonstrating the difference in the debug view when passing UVs though in pixel and vertex shaders.

Hello there,

The reason that the Material Texture Scales view mode does not work with a custom vertex interpolation step is because the vertex shader is overridden for the debug view, so that code is never executed. Normal UV manipulation also occurs in the vertex shader in GetMaterialCustomizedUVs, which is called from VertexFactoryGetInterpolantsVSToPS.

Exactly what the custom interpolation version will show as will depend on a few factors, but in my quick test, it shows as being more than 2X under. Sometimes the view mode can get stuck, but switching to Lit and back should fix it.

In terms of texture streaming, I’m not seeing the engine fail to stream higher resolutions mips in my test. In editor, I’m seeing the texture stream up to mip0 after moving away from the object and flushing mips. It’s possible something else is stopping mip streaming working as intended. Would it be possible to share more details about the issue?

Best regards,

Chris