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.
Expected
Texture UV scales draw correctly
[Image Removed]
Actual
The UV scales are shown as undefined
[Image Removed]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-212529 in the post.
0 |
Component | UE - Rendering Architecture - Materials |
---|---|
Affects Versions | 5.4, 5.3.2 |
Target Fix | 5.5 |
Fix Commit | 33689794 |
---|
Created | Apr 16, 2024 |
---|---|
Resolved | May 16, 2024 |
Updated | Sep 5, 2024 |