I think I narrowed this issue down to bad UV coordinates being interpreted during the BasePassVertexShader execution applied to instancing. At this line in VertexFactoryGetInterpolantsVSToPS:


float2 LightMapCoordinateInput = LocalVF_VertexFetch_TexCoordBuffer[LocalVF_VertexFetch_Parameters[ 1 ] * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + LocalVF_VertexFetch_Parameters[ 2 ]];

The issue, from what I can see, is LocalVF_VertexFetch_Parameters is not initialised in the buffers of the pass, and as a result it looks like it is using garbage UV values when sampling the Lightmap texture. The buffer is initialised for FLocalVertexFactoryUniformShaderParameters, but not for FInstancedStaticMeshVertexFactoryUniformShaderParameters. When altering the values passed in renderdoc, the sampling did change visually, but could never be fully corrected. Closest achieved was using "Input.InstanceId", but it was still not accurate.

The only other possibility I saw was MANUAL_VERTEX_FETCH forces the ISM to use this TexCoordBuffer, but if turned off, Input.LightMapCoordinate is used instead. Perhaps the latter is supposed to be used for instancing?

Steps to Reproduce

Download the licensee repro here - [Link Removed]

Open in engine, the ISM is a lot of white cubes.
Build + press PIE
Move forward until the mesh becomes visible -> mesh texture is corrupted.

Have Comments or More Details?

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

Login to Vote

ComponentUE - Rendering
Affects Versions4.234.26.2
Target Fix5.2
CreatedMay 17, 2021
UpdatedAug 25, 2022