Batching drawcalls for runtime generated gameobjects
I am trying to build an application for Occulus Quest where I take in the 3D geometry data through a streaming web socket connection from a server and build gameobjects, meshes etc. at runtime in occulus. The vertices, triangles, lights etc. are received in a JSON format which is then parsed by my application to build the 3D geometries and render it. I am using:
Unity Version - 2019.3.2f1 URP Version - 7.1.8
Since I am limited by hardware resources I want to reduce my drawcalls to the minimum. I have been trying to implement batching both static and dynamic to reduce my hardware load. I have been using the profiler to observe the performance of my application and I figured that the application is CPU intensive (Most of the time is spent on Gfx.WaitforRenderThread) and has a huge number of draw calls. I have attached the profiler images as well.
![alt text][1]
![alt text][2]
I have tried the following things to reduce draw calls
Using StaticBatchingUtility Combine method to combine gameobjects.
Applying shared materials - The way I am applying materials to my game objects are as follows: I instantiate a material object for each material of a different kind and I apply those materials to the renderer component through renderer.Material = materialInstance. Note that materialInstance is the same for all materials which share the same property.
Mesh combine to combine similar meshes into one
I am trying to use mesh baker right now. But I have no clue why the batching is not working here (both static and dynamic)
I Understand that dynamic batching requires the vertices to be less than a certain threshold but I see no batching happening at all.
Can anyone point out what am I doing incorrectly? and what are the ways to optimize performance for such an application where the geometries etc. are being created at runtime?
I have tried almost all the suggestions mentioned on forums and blogs without luck.
[1]: /storage/temp/153439-profiler-cpu.png
[2]: /storage/temp/153440-profiler-render.png
Your answer
Follow this Question
Related Questions
Trouble with Dynamic Batching 0 Answers
Static batching break : objects belong to different static batches 0 Answers
Different number of batches in Stats and Frame Debugger counts (222 in stats, 55 in debugger) 1 Answer
LOD batching 0 Answers
Why do I have this jump in draw calls / Batching not working? 0 Answers