Optimizing massive amounts of meshes?

Hello! I got this idea of creating [too-early-to-disclose], but there is a problem: it involves tons and tons of small (2cmx2cm) cubes(no, not another minecraft clone, in case you’re wondering), forming larger structures. I ran a test of maybe around ~1000 of those, and the performance was jumping ~3-16fps on an R9 290x&15 4670K, which would practically close everyone off of the playerbase. Am I doing something wrong? Is there a way of creating destructable enviroments of multiple stages of destruction without hardware from year 2060 needed? Or should I just wait till 2060, and then be able to keep going with this path? (in other words; stop even dreaming about computers ever achieving this, and go to get a new idea)

Thanks!

Make sure that you use LOD’s for your small cubes + cull the ones that are far away :slight_smile:

  • probably this will help you: It’s something like minecraft -> block generated landscape + set blocks + remove them …

I’m not sure if you’re using a Destructible mesh created with PhsyXLabs or not but here are some tips.

If you’re using a destructible mesh then having that many cubes that are using physics may be the problem. It’s key to remember that any destructible that is created within UE4 or via Nvidia’s PhysX Labs DOES NOT use the GPU for the destruction. Everything is being handled on the CPU side and this can create the bottleneck you’re seeing in your FPS.

If you are using a DM and you need further tips I’d be more than happy to offer some help. :slight_smile:

If you’re not using DM’s then Fighters tip to use LODs and cull is a great solution as well.

Well, I am not entirely sure whter to go with destructable meshes, as the end goal is destructable enviroment, (while there is no reason would need to build any blocks).
Having that kind of amounts of tiny cubes on physics will surely not work, and that I realize. I was thinking of making them be physical for a short while after they are “detached” from the main mesh, so that for instance, they have had ±2 the same coordinates for, let’s say, 10s, the collision&pysics could be turned off.
Other thing could be to look into the physX, but I would want to keep things somewhat unpartisan when it comes to performance on AMD vs NVidia (largely because I myself am running AMD, and know how it feels when developers aren’t very interested in supporting it, and the market is almost 50/50 split), but if it all ahppens on processor… why not?

Other thing I am considering is making all walls be classes, that have a variable for each block, and somehow generating a 3D model based on that data. (I have heard it only works in editor though?).

Overall, would be great if we managed to gather some resources for these kinds of games, as I am sure there are many noobs out there that would find this helpfull.

To draw thousands of small meshes efficiently (for example, individually positioned rocks) you would typically use the instanced mesh system.
If each of your cubes needs data that you can’t supply as per-instance data, or if you need different geometry per instance, then that wouldn’t work.

It’s not instancing, it’s batching where it can combine multiple instances of the same object into a single object so that it reduces draw calls.

how would I go about doing that? I thought that it would be crazy if there was no way to optimize it (no engine, or atleast game, is crazy enough to render 400 blocks instead of one if they are in perfect grid now would one?)

I need to be able to “Make physical” the single cubes when an event is triggered, that’s all :slight_smile:

I won’t claim to be a wizard either with destructibles or with UE4, but I do have a bit of relevant knowledge hopefully…

as I understand it, GPU physics acceleration isn’t enabled in UE4 yet… so (at the moment, with regard to destructibles anyway) it doesn’t matter whether you have an Nvidia or AMD card.

I’ve been thinking that it might be possible to use normal meshes as triggers. when the trigger is set off, it is swapped for an APEX destructible mesh, which goes through its routine as specified. This way, you might get the benefits of mesh LODs/batching along with the really nice APEX destructible visuals, you can crumble chunks down to particle effects… then to nothing, so pieces lying about a level needn’t be a huge overhead or interfere with gameplay… and (when GPU acceleration gets implemented UE4) Nvidia users get the additional benefit.

Apologies, I haven’t tested it… its just a theory :smiley:

Just an additional comment, of Unreal Support answered a similar question here https://forums.unrealengine/showthread.php?50362-LODs-for-APEX-and-usual-destructible-meshes&highlight=apex