Particle GPU Instancing in URP7/2019.4

Hello there !

I was trying to port the gpu instancing for particles from URP10.1.0 and was quite successful so far. I simply copied over related shader functions from render pipeline urp & core package. Frame Debugger shows that it’s using DrawMeshInstanced and stats window shows that batches are saved. image → Screenshot-2020-10-29-142843 hosted at ImgBB — ImgBB

But when i check Custom Vertex Streams, it seems like something goes wrong. Even though the right properties are being transmitted, in the Game View it seems like the objects are occupying only a small number of positions, while the number of saved batches stay the same. image → Screenshot-2020-10-29-143132 hosted at ImgBB — ImgBB

Is this expected behavior because i ported the URP Code down a few Versions and the Engine itself isn’t properly setup to handle this, or have i missed code that should have been copied over from URP10.1.0 ?

Thanks in advance :slight_smile:

1 Like

First, my testing on Oculus Quest with Renderdoc confirmed that gpu mesh instancing also works on device.

I’ve got a followup Question though:
Would it also be as easy to implement instancing for normal mesh renderers and/or rigid bodies?. My last info on this was that instancing and srp batcher don’t work alongside each other. But judging from the particles gpu instancing they can work both at the same time.
Also: would that even make sense? is the srp batcher already as fast as instancing, and apart from particle systems there’s not much to gain from implementing it?

I’ll tag you two people, because i believe you might have some insights to share
@bgolus @richardkettlewell
Hope that doesnt come off as rude ^^

When the particles get “messed up” it is a clear sign that the custom vertex streams are incorrect. However, as you say, the UI is telling you everything is ok. i’m not sure what the problem could be. Without knowing what changes you’ve made, it’s impossible for me to say more.

Does the same test behave properly in Unity 2020.2 + URP 10?

Particles don’t currently use the SRP batcher.

Sorry I don’t know the answer to this - i would have expected something as fundamental as this to already be working, but I’m not on the URP team so I don’t know if it works or not. We have a dedicated forum for URP, in case you don’t get an answer here: https://forum.unity.com/forums/universal-render-pipeline.383/

@richardkettlewell
Thank you very much for taking the time to answer my questions :slight_smile: !

  1. The same test behaves properly in 2020.2 + URP10.
    2.I know that particles don’t use the SRP Batcher. From the information i gathered around here, i was under the impression that gpu instancing and srp batcher could not be used at the same time in the rendering loop - obviously i was wrong about that.
  2. All right! Thank you - i will keep on investigating !

I’m gonna make an overview of the changes that i’ve made to the URP, and post a link here for other people to use. Gonna take me some time though

1 Like