Hi!
I’m working on a project in which I’m using instanced meshes to draw a trajectory of a spaceship in 3D. These meshes are simple planes, without any texture, only some emissive color alternation.
Recently I’ve noticed a strange issue when I’m zooming in and out. It looks like this: https://www.youtube.com/watch?v=uChcbAt5vbE
At first glance it looked to me like it was z-fighting, however I’ve checked thorougly and it seems it’s not that.
What I do is, after creating a new mesh instance I set a custom data value - its index (named SegmentIndex). During runtime, I update a custom param to signal which index is currently active (CurrentSegmentIndex) and another custom param which is supposed to indicate a transition point (CurrentSegmentPercentage). In the material if SegmentIndex == CurrentSegmentIndex I select which part of the mesh is supposed to be highlighted by comparing the CurrentSegmentPercentage with TexCoord’s X component.
Here’s a screenshot of this logic:
Now what’s really strange is that this issue becomes more apparent the higher index the instance has. Fifty or so first instances don’t show this issue in any way, then it slowly creeps up, initially barely visible and becomes very apparent around index 300+.
It seems to be connected to camera. While the camera is moving it’s flickering. When it stops it’s either working as intended or not highlighting at all. When looking from a different angle after ejecting in editor it looks like this (while the camera is stationary):
When I tested it briefly with orthogonal camera it seemed to work just fine.
I was using UE4-26 and updated to 27 which did not help.
I’m really confused.
Do you guys have any idea on what’s happening here?