Jump to content

  • Log In with Google      Sign In   
  • Create Account


Optimized Unity Compute Shader Particlers


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 hawksprite   Members   -  Reputation: 124

Like
0Likes
Like

Posted 25 December 2012 - 11:59 AM

So i've been toying with compute shader's to handle particle control and have run into an issue.  Everything is working fine so far but there's a bottleneck.  When I get up into the hundreds of thousands of particles it starts to lag, I haven't implemented other post processing effects on the particles such as blur and what have you so I'm concerned that there might be a serious performance problem later down the road.

 

I'll attach the script, shader, and compute shader.  I haven't done much optimization yet and i'm not sure how to properly use compute shaders so any advice you guys can give me would be greatly appreciated.  Thanks.

 

I just checked and it gets about 40-50 fps with 500k particles.

 

Part Controller:

http://pastebin.com/zJ9C5Ehx

 

Part Controller Shader

http://pastebin.com/GB24qttX

 

Part Controller Compute Shader

http://pastebin.com/zTw6rVAN



Sponsor:

#2 MJP   Moderators   -  Reputation: 10917

Like
0Likes
Like

Posted 25 December 2012 - 12:44 PM

How large are you particles? It's very easy to become purely bandwidth or fillrate bound when you have lots of particle overdraw, particularly if you're running on a low or mid-range video card. I would suggest disabling the rendering of your particles so that you can try to isolate whether it's the simulation step or the rendering step that's taking a long time. You can also use a NULL pixel shader or disable color writes when rendering which will help determine if you're bandwidth/fillrate bound from overdraw. If that is the case, you can try making your particles smaller or you can try rendering them to a half-resolution render target.


Edited by MJP, 25 December 2012 - 12:45 PM.


#3 hawksprite   Members   -  Reputation: 124

Like
0Likes
Like

Posted 25 December 2012 - 02:52 PM

I did some tests and here's what I found.

 

With rendering of the pixels on at a short distance (Not right up against it) I got about 42 F.P.S. with 500K particles.  Then when you got up close it dropped to about 20-15.

 

With rendering off (Also not setting the buffers to the shader material) It got the same 42 F.P.S. on average (It occasionally would go to about 70fps for a few seconds).  But didn't have the drop off when you got close to where they would be, which makes sense.

 

So there's a definite bottle neck with rendering up close, but there's also a definite 20 fps drop happening on the compute shader to just control the particles.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS