I'm considering porting parts of my project over to using DOTS entities to render since I suspect it would be a massive performance improvement. (Unity's batching-and-whatnot loop is like 65% of the frame time because there are 10k+ gameobjects) Reading over the API it seems like Entities Graphics only supports URP and HDRP shaders. Am I wrong about that, and if not should I try to
a) modify the package (if i do this will i need to redo it with every update?)
b) use a lower level API (how much more painful is this?)
c) just not do this :(
#Making DOTS rendering work with a custom SRP.
1 messages · Page 1 of 1 (latest)
Graphics does support custom handwritten vert/frag shaders but it has to be in a very specific format and pulling vertex and per instance data is very cumbersome. But possible.
The "low level" api where you set up the meshes and materials and schedule the draw commands is actually baked into core unity. It's called the BatchRendererGroup: https://forum.unity.com/threads/new-batchrenderergroup-api-for-2022-1.1230669/
Depending on how your current code is structured, I would recommend first exploring less "complete overhaul" solutions like a command buffer draw mesh instanced or procedural generation. If you want to use entity graphics, it will definitely improve your rendering performance especially with 10k GOs which was what it was designed for. But it's very specific in what shaders it supports due to how it attempts to render all GOs in as little draw calls as possible.
If you want to use Entity Graphics, you'll need to convert your entire project over to Entities which, depending on the stage of development, might as well be recreating from scratch. BatchRendererGroup is not much better as it has specifically been designed for entities.
I don't actually use Entity Renderer nor BRG as my visual representations are all sprites and 2d. But for 3d meshes, I would recommend first trying a custom renderer feature in HDRP or URP before considering moving to Entities Renderer or BatchRendererGroup.
thanks so much for the detailed response! we have our game logic entirely seperated from unity and all gameobjects are generated procedurally at runtime which should make the conversion process much easier, but still this does seem like a big task. is it possible to have gameobjects and entities that are getting rendered at the same time or is it all one or the other?