We are seeing an issue where some materials are showing up with black textures, incorrect normals, etc. in standalone cooked builds (PC and console). We were able to track this down to some virtual textures not being bound properly in the materials, with a default black texture/page table being bound instead. The issue seems very similar to these two questions from 2023:
[Content removed]
[Content removed]
Running r.FlushMaterialUniforms as suggested in the first link does indeed fix the materials in our case.
I added some additional logging code, and it looks like what is happening is:
- Texture has its PostLoad() called.
- This triggers UTexture::UpdateResource(), which sets PrivateResource and then calls ENQUEUE_RENDER_COMMAND(SetTextureReference) to queue up the RT-side update.
- FMaterialRenderProxy::UpdateDeferredCachedUniformExpressions() is called from the Render Thread, which calls FMaterialRenderProxy::AllocateVTStack(). This calls Texture->GetResource(), but because this is running on the RT, that looks at PrivateResourceRenderThread, which is not yet set.
- The render command for UTexture::UpdateResource() runs on the RT, and sets PrivateResourceRenderThread, but it’s too late.
Here’s an example from the log for one texture - the log warnings are in UpdateResource and its render command, and in AllocateVTStack:
-----------------------------------------------------------------------------------------------------------
Line 13074: [2025.05.28-01.24.16:243][ 0]LogTexture: Warning: Main Thread: UpdateResource with NewResource T_ceramicTile_01_N
Line 13521: [2025.05.28-01.24.16:357][ 0]LogMaterial: Warning: Material ‘MI_ceramicTile_01’ looking for Virtual Texture ‘T_ceramicTile_01_N’, but it is not available!
Line 13524: [2025.05.28-01.24.16:357][ 0]LogMaterial: Warning: Material ‘MMI_GEN_44_room_floor_MI_ceramicTile_01’ looking for Virtual Texture ‘T_ceramicTile_01_N’, but it is not available!
Line 13527: [2025.05.28-01.24.16:357][ 0]LogMaterial: Warning: Material ‘MI__GEN_44_room02_01_tileGEN_44_room_floor_MI_ceramicTile_01’ looking for Virtual Texture ‘T_ceramicTile_01_N’, but it is not available!
Line 13644: [2025.05.28-01.24.16:377][ 0]LogTexture: Warning: Render Thread: UpdateResource with NewResource T_ceramicTile_01_N
-----------------------------------------------------------------------------------------------------------
I thought this might be related to the fact that we have a couple of SceneCaptures which run before the main view processes - perhaps that was causing the uniform expressions to be updated earlier than expected on the RT. However, disabling those did not seem to make a difference.
I am curious if this is an issue that is known and has potentially already been fixed in a newer version of the engine. We are currently running on version 5.4.2 with local modifications. It’s possible that some change we have from base 5.4 is involved here - I plan to try to reproduce this in a simpler project on the base version of the engine, but I have my suspicions that this may only manifest in the fully-populated streaming map.