Description

When a Material uses WorldPositionOffset, the MaterialTextureScale is calculated incorrectly because FMaterialUtilities::ExportMaterialUVDensities() calls FMeshRenderer::RenderMaterialTexCoordScales() without disabling world position offsets, and the resulting texture coordinate scales are undefined resulting in an empty TextureStreamingData at the end of FMaterialUtilities::ExportMaterialUVDensities().

See the linked UDN in the Additional Info field for details and an example project with assets to repro.

 

Also, during my investigation I saw that RenderMaterialTexCoordScales() sets a property called ViewFamily.bNullifyWorldSpacePosition but that property isn't used anywhere in the codebase.  It looks like the code in SceneRendering.cpp that used it (added in CL 2955403) was removed in a merge a long time ago in CL 3019494.  This logic looked like this:

#if WITH_EDITOR
    if (Family->bNullifyWorldSpacePosition)
    {
        // Forces world space position to 0 and view vector to up.
        ViewUniformShaderParameters.SVPositionToTranslatedWorld = FMatrix44f(
            FMatrix(FPlane(0, 0, 0, 0),
                FPlane(0, 0, 0, 0),
                FPlane(0, 0, 0, 0),
                FPlane(0, 0, 1, 1)));
    }
    else
#endif 

and has since moved to SceneView::SetupViewRectUniformBufferParameters(), but adding the code back that forces the world space position to 0 doesn't fix the issue.  Someone knowledgeable about Material views can evaluate if all the bNullifyWorldSpacePosition code should be removed, or if that bit of logic should be re-added.

Steps to Reproduce
  1. Create a Material that uses a WorldPositionOffset
  2. Assign the Material to a mesh in the scene
  3.  Set the viewport view mode to Optimization Viewmodes>Material Texture Scales.

Expected
Texture UV scales draw correctly
[Image Removed]

Actual

The UV scales are shown as undefined
[Image Removed]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-212529 in the post.

0
Login to Vote

Fixed
ComponentUE - Rendering Architecture - Materials
Affects Versions5.45.3.2
Target Fix5.5
Fix Commit33689794
CreatedApr 16, 2024
ResolvedMay 16, 2024
UpdatedMay 18, 2024
View Jira Issue