Hey all,
I’m just curious (because I honestly don’t know), why does Unity use so much CPU when rendering? Shouldn’t this be offloaded to the GPU, or am I not understanding something?
Thanks a bunch,
Nathan
Hey all,
I’m just curious (because I honestly don’t know), why does Unity use so much CPU when rendering? Shouldn’t this be offloaded to the GPU, or am I not understanding something?
Thanks a bunch,
Nathan
Unity offers no way to render on CPU at all (thats why it does not work on bad android devices too for example)
the high cpu load you see is likely from not limiting the frames, then it will all push until the first hardware component bottlenecks. depending on the complexity of the game thats either the GPU or the CPU (if you don’t own pro and didn’t overdo it its nearly always the cpu).
Look at Application.targetFrameRate for how to leave the framerate and cpu need at a reasonable level
Thanks Dreamora,
I think I narrowed the problem down but am still a bit confused/curious. I have a scene that has about 400 draw calls. About 300 of those are small polys with a Transparent/Diffuse shader on them. I’ve now used a mesh combine on them so they are about 6 draw calls total (which speeds stuff up very nicely).
However, without the combine the Profiler tells me that Render.TransparentGeometry takes about 4ms.
So, is Unity doing some sort of sorting on the CPU or some kind of pre-calculation before the GPU is rendering the Transparent objects.
As a side note, capping my framerate doesn’t change anything. If I cap it at 30 FPS the above takes about 4ms and if I don’t (and it’s at about 70 FPS) it takes about 4ms.
To wrap it all up, Unity is doing some sort of pre-calculation on transparent geometry on the CPU, does anyone know what exactly that is?
Thanks,
Nathan
a draw call is a cpu and memory transfer operation. Less draw calls = less CPU util.
yes it will always take 4ms if its distinct objects
thats just the time it needs to set it up and feed the graphics driver with the data.
don’t trash it as much with data that needs to be sent one by one (cause transparent will not batch - depth sorting bases on the meshes 0,0,0 position not pixels on transparent) and it will magically run faster
Thanks guys,
I used the combine the children script UT provided on the transparent geometry (because they were a bunch of little “lights” close to each other) and got the Render.TransparentGeometry down to less than 1/2 a millisecond… very nice.
Thanks for your help guys,
Nathan
Glad to hear and looking forward to see what you created that was able to flood it that much with a few quads
May I just ask how did you used the mesh combine? It does not seem to work for me. PM me if you can
I’m running into similar problems as the OP (i.e. the profiler shows that CPU-side rendering is causing enormous lag). In my case, the lag is always present even when hardly any geometry is in view; but when I deactivate a large amount of geometry BEHIND the player the lag suddenly disappears and the CPU-side rendering usage drops dramatically. I’m hoping one of you guys can shed some light on that : why would it take so much time even when most of the objects aren’t visible?