HISM Instances flicker when moving

Hi, I’m building a tile based map using HISM instances, but at some places when moving some of the instances start to flicker, and I have no idea what can be causing the issue.

If I deactivate Occlusion Culling at Project Settings > Engine - Rendering the flickering stops, but I don’t want to have all the unseen tiles draw on the screen.

This is a short video of what’s happening:

Any idea of what can be causing this issue?

Thanks

I had a similar issue when removing and adding instances to an HISM

I am working from c++ and calling BuildTreeIfOutdated(false, true); on my HISM after I add/remove elemnts fixed the flickering.

There should be a similar function for BP I imagine.

Hope this helps

Hi, sorry for the late answer, at the moment I am prototyping the idea via Blueprints, and I didn’t find any equivalent function to call in Blueprints, I’ll try converting it to C++ to see if it fixes my problem.
Thanks!

Hello! What do you mean by moving the instances? You’re not really supposed to move the instances of a HISM at runtime (or at least mot very often). I don’t see any movement in your video though. Could you show us your code / blueprints?

Hi! Sorry the explanation I gave is not as clear as I wanted, the flicker happens when the character moves, there are some spots where the instances start to flicker, I don’t do any instance moving at runtime.
The game has a fixed “top-down” camera, and I don’t know if it may be camera related.

This is a snippet of the blueprint that generates the map:

Thanks!

1 Like

Open the Static Mesh asset you are instancing, and try extending the bounds offsets:

Not by too much though… You should try just bare minimum which makes the flickering go away (if it does).

2 Likes

Why not? I mean the HISM/ISM components even have dedicated functions to batch update transforms of all the instances at once. If you are not supposed to do that, why would someone at Epic explicitly add support for doing it efficiently?

Hi, It worked, I tried to increase HISM Bounds Scale, but it did not fix the flickering, but the bounds extension of the static mesh seems to have fixed the flickering.

Thanks!

If you move HISM instances it needs to recompute the cluster tree and that is an expensive operation. You can move them if you don’t have a lot of instances or if you don’t do it often and / or do it at appropriate times. Definitely don’t move them per frame though. Always batch update the transforms.

(As a general rule just because you can doesn’t mean you should :sweat_smile:)

@Can you go to you static mesh and show us its bounds by clicking the bounds button in the toolbar at the top without any positive / negative bounds extensions? UE should correctly compute static mesh bounds so you shouldn’t have to add extensions.

Also, another useful debugging tool in this case is to go in your editor viewport > Show (top left corner, last button) > Advanced > enable HISM / Foliage Cluster Tree. This allows you to check if the bounds are computed correctly.

1 Like

These are the bounds, as a prototype I’m using the default 1M_cube from the engine.

This video shows the bounds with the Foliage Cluster Tree View activated so you can see the bounds and the flicker.

1 Like

I had a similar issue to this, not sure if it’s exactly the same, but I wanted to document it here in case others run across it as the solutions here didn’t fix it for me.

See below for a video of my issue. Notice the cube that shimmers, based on screen size / viewing angle. This only happens to that cube because it’s the only one I’ve moved, but after moving it once, it’s stationary. Also in my case I’m not using HISM but just ISM. Turns out the fix was to update its position using UInstancedStaticMeshComponent::BatchUpdateInstancesTransforms instead of UInstancedStaticMeshComponent::UpdateInstances. In my case I was using ISMs via the Mass Entity system, which by default uses the latter. Thankfully, there’s a console command to switch it to the former, via Mass.CallUpdateInstances 0. I still don’t know why UpdateInstances causes this, seems like a UE bug.