Is there any sort of definitive doc that talks about the differences between BRP and URP in terms of draw-calls and batching, how workflows for optimizations and tracking this over time changes with URP?
Did a deep dive today to answer some of my own questions, posting here for anyone else that has the same ones. Iāll add to this if I learn anything else soon. Also happy to have ppl point me towards things I donāt have here. Thanks.
Some links I found very useful
- https://forum.unity.com/threads/newā¦pipeline-for-advanced-unity-creators.1323774/
- Measuring Performance
- Ultimate guide to profiling Unity games | Unity
- SRP Batcher: Speed up your rendering
Unity stats window doesnāt work in URP?
- Read more in the catlikecoding tutorial
- āURP uses the SRP batcher by default, but the statistics panel doesnāt understand it. The SRP batcher doesnāt eliminate individual draw commands but can make them much more efficient.ā
Draw-calls donāt matter anymore, so what do I do? How do I know if Iām winning?!
-
Search this article for āHow to check SRP Batcher efficiencyā
-
"real CPU cost comes from setting up the DrawCall, not from the GPU DrawCall itself "
-
āSRP Batcher doesnāt reduce the number of DrawCalls. It just reduces the GPU setup cost between DrawCalls.ā
-
āyou can use any number of different Materials if theyāre using the same shaderā
-
To me this feels similar to the benefit of MaterialPropertyBlocks but on the entire Material level, instead of individual material properties. Thatās cool!
-
Tip: Use the FrameDebugger to check the number of DrawCalls stuffed in a batch
-
āTo get maximum performance, you need to keep those batches as large as possible.ā
-
Tip: āIf youāre creating your own SRP, try to write generic āuberā shader with minimum keywords.ā
Is FPS king? Noā¦
- Page 13 or FPS VS FrameTime
- Frames per second is a deceptive metric
- āMeasuring your gameās frame rate in frames per second (fps) is not ideal for delivering consistent experiences for your players. Consider the following simplified scenario: During runtime, your game renders 59 frames in 0.75 seconds. However, the next frame takes 0.25 seconds to render. The average delivered frame rate of 60 fps sounds good, but in reality players will notice a stutter effect since the last frame takes a quarter of a second to render.ā
- Build a Frame Time counter or use Unityās
Converting Custom Shaders to URP
Resources for getting to know URPās SRP Batcher
-
At the bottom of the above thread thereās a FAQ that includes
-
How do I know Iām using SRP Batcher the best way possible?
-
SRPBatcherProfiler shows similar timing regardless of SRP Batcher is ON or OFF. Why?
-
Global FPS didnāt change when I enabled the SRP Batcher. Why?
Do you think itās a better option than optimising Builtin?
Iāve found that your average URP scene is a little faster than your average Builtin Renderer scene. It obviously depends though - Builtin may sometimes be faster, depending on the scene - and URP has a lot of limitations to consider as well. I would say that URP is generally better optimized, but like anything it isnt perfect.
My experiences, so far, have been that a few wiggles and tweaks can get me far better performance out of Builtin. Especially if I do a lot of my static-ness of objects to make sure theyāre known of as static by the renderer. And the advantages of being able to find optimal shaders, easily, has been all in favour of old uses of Builtin.
And every time Iāve tried URP, within a few days Iām at an impasse with something thatās not yet been added to it, or is (by design) simply not possible. But I keep trying it at each major release.
Could you be more specific? My experience is that taking advantage of static objects (and therefore static batching) has a significant performance boost in all shipped Unity renderers (Built in, URP, and HDRP), but its a comparable boost between them. It may be that I have some other significant performance bottleneck that you dont (which is why Iām askign for more details), but I wouldnāt say Built-Inās result were āfar betterā in my experience.
What sort of scenes are you seeing these results in? Are these actual real, game scenes (IE practical, real world cases) or test scenes? What specifically are you doing to the renderer (you specified ticking static boxes, but is there anything else)?
As for the rest of what you say, your not wrong. Shaders are easier to find for built in (and indeed HDRP) compared to URP and the development of URP has always felt really slow to me. The lack of features does annoy me sometimes (though I wouldnt go as far to say it creates an impasse - what features are you needing?
I tend to try to make my own shaders when I need something Unity isnāt shipped with, so I have less of a problem with trying to find shaders for URP. There are some things I want but dont know how to make (eg non-fake volumetric lighting) but I am aware of several assets for URP that do that, and technically Unity has considered making volumetrics for URP by default, its just really low priority (its on the roadmap i think, under for consideration)
ā
Short answer I would say is yes. Longer answer would be more like it depends on what youāre doing in your game, if youāre making use of some of the things that URP does a really good job of optimizing, then using URP would be best cause itās just done, you donāt have to try and do that in BRP which would likely be complicated and time consuming.
Here are some things that URP does much better
- Decal Projector - Super efficient! and feature rich
- Depth Texture - Used in water, fog, stuff like that. This is hugely more efficient, in BRP each opaque drawcall is an extra draw to be placed in the Depth Texture. In URP itās just 1, all the opaque objects are done in one pass for the Depth Texture.
- In BRP using the same shader, but different materials would break the drawcall batching, making more draws. In URP itās shader variants that breaks the batching, which is much lower level. So now, you can have the same shader and duplicate as many mats as you want, each still being batched together. Unless youāve got some fancy material with toggle-able options, which might trigger some new variantā¦ but largely, a great optimization and one I donāt think the average dev could pull off in BRP.
Posting a new thread here as I continue to seek clarity on efficient use of shaders/materials in URP. Encase someone reading this thread ends up with the same question Iām asking in here.