UE 5.6 - Grass Overlapping Sphere Count returns zero

Hi,

it seems that the Grass Overlapping Sphere Count BP node has stopped working in 5.6. It returns 0 no matter what I do. The exact same mini project works just fine in 5.3 where the node returns 3 as expected in this very scenario.

Has anybody came across a similar issue? Is there a checkbox I’m missing or something?

The cubes are spawned by the landscape grass mechanism. All values are default except for the Grass Density and Scale X parameters, but unless set to zero, none of them really matters in this regard AFAIK.

Also, the GetInstancesOverlappingSphere and GetInstancesOverlappingBox methods of the UHierarchicalInstancedStaticMeshComponent class always return an empty array instead of the indices of the instances being overlapped by a shape. That also worked fine in 5.3 so I guess the root cause is the same. Whatever it is.

My Level:

Sphere Actor BP:

Landscape Material:

Landscape Grass Type:

After debugging this for a while now, I’d say that the overlap functions are currently bugged, at least for landscape grass HISMs. The landscape is partitioned into cells and each cell has its own HISM components, but most of them have either no instances or instances with nonsense transform caches.

I’ve also tried debugging this (see image) in LandscapeGrassType:
image
which seems to allow for CPU access on the instance buffers, but no instances are ever cached on the CPU from those buffers.

If you’re willing to modify engine code you could theoretically extract these yourself, UGrassInstancedStaticMeshComponent::AcceptPrebuiltTree is a decent starting point (FStaticMeshInstanceData* InSharedInstanceBufferData is the instance buffer). However, I wouldn’t exactly recommend this because this could just be the top of the iceberg, some other parts of CPU instance handling might’ve been removed as well.

In conclusion, this currently doesn’t work, sorry. If this is vital I’d suggest querying Epic directly on when/if this is getting fixed.

1 Like

Thanks @Kemichar.

It works fine for HISMs used for hand-painted foliage. There’s this PerInstanceSMData array in UInstancedStaticMeshComponent that gets populated in that case, but is empty in landscape grass HISMs. The overlap logic seems to depend on the array.

Yes, this functionality is vital for my project. That’s why I actually tried messing with the code, but its complexity just goes far beyond my understanding.

I submitted a bug report to Epic two days ago. All I can do is wait, I guess…

1 Like