Download

Instanced Static Mesh performance drops with overlap

Hello all,

I’m having huge performance issues when using an ISM component with a large number of overlapping instances. My (minimal) setup is as follows:

A simple actor with an ISM component is placed in the scene, with a default opaque, unlit material (enabled for ISM) and a simple quad mesh, consisting of 4 vertices and 2 triangles. On Begin Play, 10000 instances are added (I need to add millions, but the performance issue already arises with only a few thousand). All instances are added at the origin, so they all occupy the same place. They’re all static, have no collision or overlap enabled and don’t cast any shadows.

When a bit further away from the meshes, FPS are at ~120 and the scene looks like this:

As soon as I get close to the instances, FPS drops heavily:

Does anyone have an idea on why that happens and what could be done to avoid it? I looked at the rendering pass with renderdoc, and it shows an absurd number of pixel shader invocations for the


ID3D11DeviceContest::DrawIndexedInstanced

:

Thank you all in advance for any hints or tips,
David

Why would you think that it is not expected? You are overdrawing the thing 10000 times.

I’m mostly surprised at the relation to the distance to the meshes. Shouldn’t the overdraw issue happen unrelated to that? Or is that just the amount of pixels that are actually drawn.

They occupy more fragments, when being closer?

Makes perfect sense when you say it like that, thanks :smiley: