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?
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.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-115870 in the post.
1 |
Component | UE - Graphics Features |
---|---|
Affects Versions | 4.23, 4.26.2 |
Target Fix | 5.3 |
Created | May 17, 2021 |
---|---|
Resolved | Jul 19, 2023 |
Updated | Aug 17, 2023 |