Flickering Foliage when destorying an actor using the same mesh

I am currently making my forests destructible by identifying which instances are hit, removing them and spawning a new actor using the same mesh at that location.

When that actor is destroyed the whole forest disappears and reappears then all the trees use the same LOD and the same orientation and then they flicker back to their original look.

I found a workaround by clearing the static mesh in my actor’s StaticMeshComponent before destroying the actor.

This also happens when setting LifeSpan instead of destroying the actor.

Do you have a simple project that demonstrates this issue? That will be very helpful for getting it fixed.

In 4.10 we fixed a lot of flickering related to adding and removing instances from the foliage HierarchicalInstancedStaticMeshComponent itself, but I hadn’t heard of flickering when destroying a StaticMeshComponent with the same mesh.

Thanks

Here is an example of the issue

In the project controls are 3rd-person normal controls WASD/Mouse.
Move the sphere into trees to knock them down and 4 seconds after the first tree was knocked down and is destroyed the forest will start flickering upon spawning new actors.

Also the Sphere Pawn has a “Cause Bug” flag that turning off will use the workaround of clearing the mesh before destroying the actor thus not cause any flickering.

Thanks, I’ve reproduced this here in 4.10. I’ve entered a ticket UE-24741 to get the bug fixed.

Actually there seems to be a new problem with SpeedTree materials in 4.11 beta, I’ve opened a ticket to make sure that is fixed before release!

Thanks

Actually, the SpeedTree materials issue in 4.11 beta is the same as the flickering issue. The base problem seems to be related to SpeedTree materials. If you use regular materials on the StaticMeshes there is no flickering or rendering issues.

I had noticed that the leaves during the flickering would also get a bit weird.

Have you tried making seperate blueprints of 1) Foliage, 2) The Actor. Then destroy the ingame instance of the blueprint, in replacement of a universal copy, as it seems this bug is caused by.

I’m not sure I follow. All the trees are part of the same component that is created when you paint foliage on a landscape. Every time I hit a tree I remove that instance and I spawn a new actor in its stead to handle the destruction of the hit tree.

I am also doing the same thing for buildings and they do not flicker.

I just fixed the SpeedTree flickering bug for version 4.11. It should be in Preview 2 which is scheduled for next week so it would be great if you could check it then.

Thanks for the confirmation!

Confirmed fixed in 4.11 Preview 2.