Thank you for the reply!
Let me provide you with more context:
First perf thread: [Performance] What is eating up frametime in this scene with only simple 3d hexagon meshes?
Thin instance animation: Can thin instances be animated? - #11 by douglasg14b
- I’m using thin instances because normal instances are unworkable on mobile (Even with the usual perf optimizations). The performance degradation is cripplingly bad just having 500+ instances of a simple mesh just sitting around (500 tiles for example). We’re talking a couple FPS on older phones, almost entirely CPU bound.
- Even after perf optimizations, they are still pretty borked, thin instances is the only thing that has brought big perf jumps aside from freezing the scene.
- I’m not animating thin instances directly. I actually remove the thin instance (By updating the buffer), add a normal instance in it’s place, animate that, and then remove & replace it with a thin instance on animation end. The performance characteristics are almost entirely bound to the CPU cost of having normal instances on scene, the actual buffer updates are negligible, and are performed in an
O(1 + 16) fashion.
Alright, that context out of the way, let me respond to your comment:
- This is a performance optimization I can make at a later date, I don’t have problems with tris/vertex counts right now, but cutting away sides that are unseen and only having tops is already in the books as a battery usage optimization.
- This is a good suggestion, but given the complexity and level if jank I would inherit (Plus I have zero exp on shaders, this would be quite difficult for me), I want to leave this on the table as a last resort.
Thankfully the stuff only needs to be dynamic when interacted with, if it was possible to batch thin instances in a way (So all thin instances from different parents that share a mat share a single buffer or something?) that would be workable as well, it would just take an extra layer of management on my end, but not that hard.
I actually made this sort of thing un unity first before ditching it for HTML/CSS/JS (My game is very UI heavy, babylon is just one particular part of the game), and had pretty good perf, though I do understand that JS is going to perform much worse than C# on that front.
Are there any in-built features or things I can change or setup that might enable this? Similar to Unity - Manual: Draw call batching (Specifically static batching, which seems similar to thin instances, except it can combine all geometry as long as it shares a material)