Hello, trying to get batching to work with no results
Have a simple scene with single prefab (mesh + material) being rendered with HDRP Lit material. Material is set to use GPU Instancing. Number of batches: 6
Each time I duplicate prefab, number of batches goes up, and up, and up - by 6 each time.
Material has one diffuse map and one emission map.
No scripts, no custom shader, all standard stuff (apart from mesh and textures).
Unity v. 2019.1.7f1, HDRP v. 5.16.1
What am doing wrong?
Screenshots:
Two prefabs are there (one duplicated off another), second one is disabled:
Bump - anyone? It seems that GPU instancing is not working here. I red through manual and tutorials on batching topic and everything is set up as it should be but still no result.
No particular information can be found also in profiler or frame debugger.
GPU Instancing works however in standard Unity rendering pipeline.
OK, after more testing (because I have nothing more interesting to do than investigating whatās wrong: Unity rendering or Unity documentationā¦) it seems that docs are not updated.
Batching works, but:
when material is checked to use GPU Instancing and SRP Batcher is enabled thereās no ādraw instancedā calls in the frame debugger visible and Stats display batched calls with - sign
when material is checked to use GPU Instancing and SRP Batch is disabled, you can observe ādraw instancedā calls in the frame debugger and Stats displays batched calls properly, as documented in the manual
Anyone from Unity Dev team please comment on this - is my understanding is correct?
Have to admit itās a bit confusing and weāre working on improving that. First, the statistics window is not up to date when batcher is ON ( because some numbers have no meaning in batcher context, ie āsaved by batcherā ). This is not ideal situation and weāre working on refactoring that statistic window to provide good metrics (with certainly new names))
Anyway if you really want to measure performance with and without batcher, I recommend you to use a small script ( SRPBatcherProfiler.cs ) . More details in that blogpost.
Regarding automatic GPU instancing, we by pass it when SRP Batcher is ON ( because in real life scene, batcher is slightly faster ). Of course you still can use explicit GPU instancing via Graphics.DrawInstanced for dedicated things.
I use the HDRP Lit shader and enabled GPU instancing for objects copied and scaled - rotated around, but the batches are still enormous (like 3000) and "saved by batchingā metric reports a minus -2000, is this meaning the batching is working ?
In March 2020 I have no idea- that whole thing with SRP transitioning is a one huge mess, on unity side.
Maybe some big customers with dedicated support from unity have any understanding of how to properly and efficiently use new rendering pipeline.
Little guys like myself are left with nonexistent or outdated documentation, confusing blog posts and sponsor videos, completely unhelpful forum and bug report replies. Itās hit and miss game.
Great that thereās raytracing tech you can show off, but not being able to properly investigate performance, without using some loose scripts, posted somewhere on the forums (because I have too much free time I can spend on hacking around instead of developing my gameā¦) its just pathetic. And this is just a tip of the iceberg of missing or broken things in the new pipeline.
I should have stayed with built in renderer. Itās at least two years, if not more, before srp become ready to production use. I wish somebody would mentioned that in multiple blog posts and videos they advertised srp in.
Also still waiting on figuring out whether my batching works or not. It says 48 batches and -48 saved. Does that mean that I have successfully messed up every single instancing-attempt I have done, or does it mean that it works?
Iām sorry, but I have to agree. Itās impossible to do any real work here, without creating all the building blocks to fit into Unity to make it work. How is there not a single particle-shader for HDRP yet? Yes, Iāve tried the beta-package they made, but those donāt support colors, so you have to write those yourself. Thatās such a weird choice to me.
I still have this problem about batching, I have a lot of objects with the exact same material and texture on them, the are not marked as static batch since they are moving, and the material is mark to GPU Instance batch. Guess what? I get exactly the same result that you guys: A high number in āBatchesā and a negative number as high in āSaved by batchingā.
I donāt find any place in Settings or HDRP asset to turn on/off SRP batching neither!
Could someone from Unity shine a real light here? Please
+1 to this. In frame debugger it shows that SRP Batcher works and batches things, however, if you try and use RenderDoc, youāll see that in fact absolutely nothing gets batched, even static stuff. Unity 2020.1b8, HDRP 8.1.0
Look in detail on the draw call and the definition of SRP batching youāll see the difference .It indeed does 1 draw call each but reduced the states changes from 5-10 to 1. Thatās what SRP batcher does, reducing CPU overhead by reducing the state changes that occurs when you change the shader.
Without SRP
With SRP
Still 2 draw calls, but overhead for each is significantly reduced.
Can someone please provide me with how to use batching properly in HDRP I have looked at all the documentation and itās either all outdated or very difficult to follow. Static batching no longer works in HDRP and GPU instancing seems to be causing trouble with certain people.
I have an RTX 3070 and I am getting 500 batches on simple scenes and 20K batches on larger but medium sized scenes I cannot release a game like this if profiling it is broken as the fps count is very low.
I was told about the SRP batcher but I canāt find it in HDRP and the docs donāt help or are telling me to use scripts and such and such. I thought HDRP was production ready?
After working with both pipelines for long time now, I think SRPs are nowhere even close to near production ready, URP not even has point light shadows and both URP and even more HDRP are generally extremely slow comparing to standard, both pipelines are largely useless imo for any serious project atm, i give it 1-2 years to be fully realized, if ever can be with such complexity and overhead.
Thatās a real shame because I was just getting to like HDRP. I canāt go back however because of things like Subsurface Scattering and the beauty of the shaders. A lot of what you say is right and particle effects arenāt working in HDRP properly and other stuff but there hasnāt been anything serious until the batching issue.
Though I still didnāt get an answer to my question about how to use the batching?
I will have to bring out mesh combine studio if the batching is really that bad because it uses its own batching system and works on all pipelines.
If all else fails Iāll have to go back to standard but weāll see Iāve come to far to turn back now.
If you want/need to use it - then use it. Sure, its not an ideal solution, but its really good nevertheless. We use it for our project btw: https://www.youtube.com/watch?v=2Xhcb2iJCU4
They do, you just need to use HDRP compliant particle shaders.
Static batching still works, i dont know where you got the information that it does not. SRP Batcher is enabled by default in HDRP and can only be disabled through scripting. Anyways, batches is just one of performance metrics, open up GPU profiler and look at what exactly is taking the most time. And if you think something takes more than it should - file a bug report.
I find only one easy way to force HDRP to use instancing - import hybrid rendering package to project, and throw all static geometry in to the entity world.
You are probably right itās probably a bug because if the Batcher itās enabled by default then it means Unity just canāt handle so many objects and they need to be combinedā¦
In regards to the particles it looks like they are listed in the package manager instead of out of the box.
Ah I just looked up the Hybrid Renderer and I understand now. Thanks for that at first I didnāt understand what you meant by Hybrid Renderer I was thinking is this a new renderer that combines HDRP and URP but nope itās just some troll at Unity who should get a pay cut for naming it something other than DOTS.