I decided to give ecs another go since trying it when first available. It took a few days but I rewrote a simplified spline system that a project is using.
So I created a benchmark which creates 10000 gameobject/entities from a prefab and moves them along the same spline.
The ecs side works amazingly with the entity updating and spline position computation but falls short on the rendering front which ends up making it slower than using game objects.
Go spline time: ~19ms
Go render time: 1.7ms
Go FPS: 22.7 FPS
This is running on a very old laptop atm (due to what is available over the holiday period)
The issue is that the ecs system doesn’t have seem todo any batching so there are 10k draw calls. Is there a way to fix this? Is the dots hybrid package the recommended way to render or should I be using one of the rendering pipelines?
Is this just the current state of things? If so I’ll look back in a year or so to see if this has changed at all…
Yes, you should be using the DOTS Hybrid Package + one of the SRPs. ECS render batching doesn’t exist with the old pipeline. I’d recommend upgrading to the latest 2019.3 release candidate (in the beta section of the hub) and try messing with the latest packages.
Also take into account if profiling in the editor there are various safety checks enabled, the only true measurement of ECS performance at this time is in a built player (although if your ECS code doesn’t deal with rendering, you’ll generally see an improvement with burst).
Bear in mind, I think only HDRP will have the full instancing support as of current. The plan is to have full URP instancing support mid-next year. There were some issues with the way URP supports instancing that need to be addressed first (on top of all the other higher-priority URP features people are still waiting on. Like Camera Stacking and custom PP V3)
I’d expect both to be fully usable around Unite Copenhagen 2020.
I forgot to turn on GPU instancing in material. Legacy renderer now runs at 20 fps with 100K objects@ 111M polys. 473 batches on a 2060rtx
I’d say f3 fixed legacy + DOTS performances and I remember that HDRP was slightly faster than legacy… ah let’s try HDRP
So I’ve gone and tried todo this with HDRP but sadly the computer I’m stuck with only has integrated graphics so HDRP refuses to run. I’m going to have to see if this works when I’m back at my desktop in a week for two.
I tried the universal pipeline and that didn’t have any difference to fps, it might have ended up making the gameobject version render a little slower in the end. Oh well.
when I turn off rendermeshsystemv2 cpu usage drops a lot and fps ups from 50fps to 130 fps
You can’t move objects but camera responds to lod, even when i turn off the lod system
Yep, this issue has been already highlighted in few threads already. It is a bit frustrating.
I am sure Unity DOTS team can tackle the issue eventually.
Ok, Got back to my Desktop and ECS is fucking awesome! Got HDRP downloaded and hit play on my gameobject benchmark… ~30 fps (~28ms) then went over to the entity benchmark scene BOOM 230 fps (~4.5ms)!
This is going to be great, now I just have to wait till they support the sprite renderer with the vector graphics package
Ok, might have spoken too soon. I forgot that you need to setup hdrp with the render pipeline and all that stuff. So i did that and the fps with entities got lowered to 130 fps. Interestingly by default the batching was still 0.
After I swapped over the single shader in the scene to a hdrp version the scene summary said it was doing 42 batches with 19982 saved by batching.
What I don’t understand with that is where did the extra 10k draw calls come from (since there are only 10k meshes but basically 20k calls with everything added together)? and why is the performance still 130 fps even though there is batching? the CPU time has increased a lot and the render time is next to nothing so could it just be that my scene is too simple to see any performance increase from hdrp vs hybrid?