Instanced Static Mesh on mobile?

I’ve used an Instanced Static Mesh in my project, but it doesn’t seem to get rendered on iPad or in the mobile preview.

This documentation page says that Static Meshes are supported on mobile, but other types of mesh are not supported. Is an Instanced Static Mesh a separate thing from a Static Mesh for the purposes of that list?

If so, is this a temporary restriction or a permanent one?

I would naively have thought that mobile would be exactly where the benefits of using an Instanced Static Mesh are most useful?

Hey shadowphiar, we currently don’t suppport it on ES 2 (mobile).

We could probably use EXT_instanced_arrays, but that introduces the additional complexity of the devices who don’t support it (e.g. Apple supports it but some Android devices might not), so we’d have to add a path to handle when it isn’t supported… We’ll add it to our list to investigate.

OK, thanks for the definitive response. I’ll look at doing my geometry in a different way for now.

Have you any plans to implement this feature on ES2 at this moment?

This was added on 4.4.

Hey, this does not seem to be working for me. I’ve my test scene in which I load in a couple thousand of the same object. On PC all is good with 13 static mesh draw calls. However when running on my mobile (Samsung Galaxy Note3) I get all the static mesh instances added (and rendered fine) but they are not batched, resulting in a good 4k draw calls.

I am running the latest, non-preview, (4.6.1) and I am fairly sure this phone supports the capability, in that other engines it does work.

Has anyone else had success with this on mobile?

Try this app to find out if your phone supports the EXT_instanced_arrays extension:

I tested it on a phone with a snapdragon 801, which although quite recent and fast apparently does not support the extension. So maybe yours doesn’t either? Those other engines might use some form of software instancing instead of hardware instancing.

Does instanced static meshes work on iOS? Anyone was able to check?

Just scroll up a bit, RCaloca already stated it is supported on iOS.

Ah yep. That answers it. I should have checked rather than assumed. Would be nice to see a software solution similar to other engines as it does make a massive difference (for my situation anyway as I am not doing much else to chew up the CPU). Anyway, thanks again.

On 4.6 we have support & some fixes for software based emulation. Not sure if it was also on 4.5.

Thanks RCaloca, awesome work. Do you know if it’s something that the engine automatically falls back to trying to do in software if the hardware extension is not supported, or is this something we need to enable. I could not really find any answer in the docs related to the software emulation.

The engine will use hardware instancing on Desktop & iOS Metal devices currently (so Android, iOS 5 and lower use emulation).

so with emulation is it limited in that draw calls will not be reduced? If they are supposed to then currently they are not… at least in my testing.

Only if you render hundreds of objects probably, reducing 50 draw calls to 30 or 20 might not be enought to show up as perf loss.

Could you please be more specific in terms what the software emulation does currenlty if it’s not reducing number of draw calls? From my experience saving 20 draw calls on mobile is a big win on mobile devices.

If the hardware/api supports instancing, we set up a separate vertex stream with the per-instance information, so 1 draw call per N instances.
If it has to fallback to emulation, it instead becomes:
for (1 to N)

  • Set Instance shader parameters (transform, color, etc)
  • Draw Call
    For 4.8 i’ll bump up the priority for getting OpenGL using the extension for instancing.

Thanks a lot for detailed answer. It’s pretty clear now.

@RCaloca sorry to dig up this old thread but I’m curious if there have been new developments/improvements for using instanced static meshes on mobile?
I’m testing developing for the GO and using ISM’s (200 billboard trees instanced or as separate meshes) don’t seem to have any/much impact on the performance.

If those trees are using masked materials 200 draw calls is going to have little performance impact compared to fill rate.

Tile bases mobile GPUs hate masked materials because they cannot apply some of their bandwidth saving tricks on them.