Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Assets [WIP] GPU Particle System

Discussion in 'Works In Progress' started by MaxProude, Mar 13, 2018.

?

Do you want to have a GPU Particle System in Unity?

Poll closed Apr 13, 2018.
  1. Yes

    100.0%
  2. No

    0 vote(s)
    0.0%
  1. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Sun.gif
    I've been working on a GPU Particle System that does NOT require compute shader and can run on Android, iOS, PC, Mac and WebGL. So far, I have a bunch of features implemented and ready to go. Other features are more tricky to implement and /or need fixing. Here's what I got so far:


    Emitters:
    Emitters are very close to Unity's Shuriken Particle System and offers lots of variety: Point, Edge, Circle, Hemi sphere, Sphere, Box & Mesh.

    Particles:
    The type of the particle can also be defined simply by choosing from a drop down list, just like any other particle System. Additionally, you can choose to display particles as points. This is particularly usefull, when working with millions of particles, because billboards might just be too big. Particle types: Point, Triangle, Billboard, Horizontal billboard, Vertical Billboard, Stretched Billboard, Tail stretched billboard & Mesh.

    Attractors and forces:
    A couple of froces and attractors have been implemented: Directional Force, Circular Force, Drag & Turbulence

    Turbulence:
    No particle system is complete without turbulence, that's why I implemented Vector Fields (from FGA files) and classic Perlin turbulence noise. Vector fields are only supported on devices that support 3D textures, though.

    What it is good for:
    This particle system is very good at displaying large amounts of particles. In order to function properly, it should be loaded with the level, and must be properly pooled. Instantiating and Destroying will ruin your performance. Environment effects like snow or rain are perfect cases for this system. Also magic and sparks effects can be spiced up with this system. I would suggest to reuse the same particle system every frame like so: Emit -> Move to new position -> Emit -> Move to new position -> Emit -> etc. On mobile devices, the fill rate is the biggest concern. That means, that particles should have a small size to reduce overdraw.

    Magic.gif

    How it works:
    This GPU particle System uses a technology, used already many years ago. You can find lots of papers about this on the internet. On Initialization, this system generates a mesh of particles, and some buffers for position, velocity and meta data. Those buffers are simple RenderTextures. On every update, the velocity buffer is rendered into the position buffer with a shader, using Graphics.Blit(). The same happens to all other buffers with different shaders. Finaly, when rendering the Particles, the shader reads the position information from the position buffer and updates its position. Since all heavy calculations are done simultaniously on the GPU, it is possible to calculate millions of particles and also render the particles many times per second. Shader keywords enable and disable features based on target platform and required features.

    I successfully tested this system with 6.000.000 particles at 30 FPS on a GTX 970 in the Editor. On a shield tablet, I got to around 200.000 particles.

    Portal.gif
    Check out the realtime effects here (HDR) and here (Mobile)

    Asset Store Release
    Initially, I was contemplating to put the Particle System on Git or the Asset Store for free. But knowing myself, I would probably just drop it as soon as it's out. To give me a bit of an incentive, I've come to the conclusion, to sell it on the Asset Store, since there are still so many more features, that I'd like to add in the future. Im going to start with a Beta phase in which Im going to give a good discount: 60% = 20.00 USD.

    Nest.gif

    The GIFs are captured from the HDR Demo so make sure to check it out yourself! (for link see above)

    I cant wait to hear your feedback.

    Cheers!

    Max
     
    Last edited: Oct 31, 2018
    Agent0023, ZJP, Mark_01 and 6 others like this.
  2. oizys

    oizys

    Joined:
    Mar 7, 2013
    Posts:
    1
    I would be interested in this for its device range especially if it were an open github project allowing for forks and such along the lines of https://github.com/keijiro/KvantStream (which precludes mobile). Particle systems are often difficult to meet all unique needs without plugins/changes in code/etc (a general purpose non-modular system would be bloated at best). I tend to make local modifications to integrate and customize systems and Unity Packages are more difficult to merge updates into than git. That said, I'd also be interested if you decided to go down the Asset Store route and I would spend money on it if it came with source code at the very least as a learning tool since I really appreciate a good example and it looks like you've done an impressive amount of groundwork that would take a lot of time and learning to be able to replicate.
     
    MaxProude likes this.
  3. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,246
    Looks cool!

    Seeing this reminds me a bit of TC Particles, which - I think - is also a GPU-based particle system.
    There is also a simple one called "KvantStream" from the famous Unity Japan developer Keijiro,
    available on GitHub. I don't know, if both can run on mobile or WebGL.

    What are the drawbacks of your system (if there are any)?
     
    MaxProude likes this.
  4. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I've done some research and of course I've stumbled over Kvant. What I want to do though, is to create a multi purpose tool. As Oizys pointed out, the system will be pretty big, but I dont think there are any drawbacks that one would consider a deal breaker. Just difficult tasks like managing permutations of shaders (because of many keywords) on all platforms and keeping the system up to date. The bigest problem here is to manage my time in a way that I can add features, while also doing support, creating marketing materials and documenting all functions etc etc... TC particles would be a great tool if it would only work on all platforms. On DX10 PC's it's probably as good as Unreals Particle Engine. Speaking of Unreal, does anyone know how many particles it supports on mobile? Never had the chance to test it out.
     
    Lars-Steenhoff likes this.
  5. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    This looks pretty neat. If you need someone to help test it out for you I have a low, medium, and high end pc. (i3 gtx860 8gb ram, i5 gtx1050 8gb, and i7 gtx 1080, 32gb ram). I would not mind seeing what it can do. I am a big fan of particle effects, I buy nearly all the big packs from krypto, mirza, and them.
     
  6. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Thanks for the offer. I'll try to polish the editor a little bit more and make sure it actually works on all devices. ;D


     
    Lars-Steenhoff likes this.
  7. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    Platform support for unity compute shaders is better than it was, I can run TC particles on my mac these days and on iOS too though I havent actually tried that yet. But yes, there are still a few platforms lacking compute shader support.

    What I find most limiting about TC particles is the shader/rendering options for the particles. Especially compared to Unitys own particle system where more is possible regarding particle shaders than used to be.

    I havent played with UE4 GPU particles all that much because I am usually interested in millions of particles and I got the idea their system, even in GPU mode, isnt quite designed to work optimally with that many particles.

    My general interest in systems such as yours, TC particles and Kvant stuff, involves using a 3D fluid sim (navier-stokes type stuff, not fluid as in liquid) to drive the particle velocity. With other systems this has been a fairly simple hack where I change the particle systems code to accept a 3D render texture rather than a normal 3D texture, and then use the 3D velocity rendertexture from the fluid sim.
     
    MaxProude likes this.
  8. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    Regarding particle shading, TC is fine for glowing particles similar to the ones in your example artwork, but is there any prospect of your system being able to do things like have particles that are lit by lights in the scene? I will understand if this is not practical at all for various technical reasons, but since this is an area where I lack understanding I thought I may as well ask!
     
  9. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    If you go down the route of releasing for free, I favour the github approach, especially as the unity package manager looks quite promising and they do plan to allow custom repositories to be used with it in future (eg see this post #5 )
     
  10. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey elbows,

    I've tested my system with a couple of shaders variants. One was the standard shader, that I modified in order to be make it compatible. It needs a kind of complicated vertex shader, but the fragment shader is completely up to you. The default GPU Particle fragment shader only displays color and textures, but I also tested flow maps, motion vectors, realtime shadows and many different blend modes. As far as fluid simulations go, you can simulate and export a simulation as a FGA file (in Maya or 3Ds max etc.) and import it into the GPU Particle System. It works pretty well and is fast, too. In contrast to TC Particles, I would be looking at a much lower price point in order to make it accessible by indie's as well.
     
    Lars-Steenhoff likes this.
  11. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    Thanks for the reply, good news about the shaders!

    And sorry for the confusion, my words about fluid sim was not really a request or question, it was just me saying how I have plugged simulations into other particle systems in the past, and that I will probably do it again with your asset! Unlike the static FGA method you mention, my stuff is not really fast because the sim is using lots of the GPU, but the results can be far more interesting and I really look forward to doing it with your system one day!

    For example here is an old and very basic demo of me doing the fluid sim thing using TC particles. If you need a mac beta tester or want to see your system used in this way soon, please feel free to consider giving me early access to your asset :D ;) Sorry for being cheeky there and I wont complain if there is no early access to be had :D

     
    khos and MaxProude like this.
  12. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Looks amazing! I get where you're coming from :) I'm a vfx artist who is always looking to get cool new effects done. Even if that means, that I have to make my own particle system. Now that I put so much work into it, I might as well go the extra mile and turn it into a proper particle system. That's why Im always happy when I get feedback. Thanks.
     
    Mark_01, Lars-Steenhoff and zyzyx like this.
  13. Doctor06

    Doctor06

    Joined:
    Nov 1, 2014
    Posts:
    31
    I think its great you are considering an open source approach to your system. Too bad Unity does not have a particle system like this already. But its developers like you that make Unity greater. Good luck on your final release.
     
    Lars-Steenhoff likes this.
  14. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    Looks like the landscape in this area for Unity is changing:

    https://twitter.com/PaulDemeulenaer/status/976475234965606402

    So there we go, Unity are working on their own solution. I suppose this is likely to influence your plans, since unity having their own modern system on this front changes the game?
     
  15. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,023
    Although to be fair, from the tiny amount of info I've heard about Unitys own system, they are targeting the HD pipeline, so there is still a place for systems that arent targeting that scriptable render pipeline.

    I got my info from the short video attached to this tweet:

    https://twitter.com/willgoldstone/status/976134529738878976
     
    theANMATOR2b likes this.
  16. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I talked to a Unity field engineer about 1 year ago. He said they already have something in the pipeline. The just wondering when it comes and if it creates top quality results. The thing with Shuriken is, that it does a lot of things now out of the box, but the editor is painfully slow and the results are not as good as they could be. I also still have to script a lot to make effects possible.
     
  17. Blue_Portal77

    Blue_Portal77

    Joined:
    Jan 11, 2018
    Posts:
    2
    Are you planning on making this public soon?
     
    MostHated likes this.
  18. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    +10 on ^ this
     
  19. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,739
    I don't like that all the cool stuff is going to the hd render pipeline, so if you can make this work on mordern mobile devices and apple tv 4k that would be so cool.

    and my preferred reslease is to host on git,

    A good example is Aura

    https://github.com/raphael-ernaelsten/Aura

    released on git and opensource
     
  20. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    Ah yes, the ol' suble, yet not so subtle "Hey, I don't want to pay, make it free". The oldest trick in the book. You do realize it takes a lot of time and effort to make something like that, then to not only have to make it, divide it for the different pipelines?
     
    tcmeric likes this.
  21. Blue_Portal77

    Blue_Portal77

    Joined:
    Jan 11, 2018
    Posts:
    2
    tbh i wouldn't mind paying for this, as i have some very cool projects in mind i could use this for, to showcase VR to people!
     
  22. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,739
    Paying is fine too!
    was not my point. my point is that this asset supports mobile and therefore is very much appreceated!
     
  23. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,280
    Looks so cool :eek:
     
    Lars-Steenhoff likes this.
  24. Eternal_Ohm

    Eternal_Ohm

    Joined:
    Jun 12, 2018
    Posts:
    1
    This looks amazing this seems like it took quite a bit of work and because of that I would pay for it but I would first want to see some videos on how it works and what exactly it does to see how the particles move and such
     
  25. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    Agreed ^ unfortunately there has been no word from him in quite some time. : ( Hopefully whatever changes Unity has coming for the particle system make up for it.
     
  26. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey, sorry for the silence. I just had a Baby and I couldn't continue working on it ;D. But Im almost done. I think I'll release it as a paid asset so I can keep working on it. I'll release it as beta with a big discount, while I add additional features. At the moment I deactivated a bunch of features, because it needs some more testing or a some other editing tools. I'll post an update here as soon as it got approved by the Asset Store guys.
     
    Agent0023 likes this.
  27. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    23,813
    I just want to say I have no interest in this asset because VFX editor generates compute shaders, and has everything I could ever imagine including HDRP support and supports collisions, signed distance fields and more. The reason I mention this is because you'd be competing with a native Unity feature that's actually got bankrolled staff working on it constantly, and I wanted you to be sure what kind of territory you were heading into with selling it.

    As far as I checked it does everything your asset does for free and includes a graph to edit behaviour, time etc.

    BUT! this is a compelling USP for webGL or very old phones. But would very old phones keep up with the fill rate anyway?
     
  28. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,786
    It could be interesting for a game in development right now where the new render pipelines are not an option. For our game new render pipelines are too much in flux, and at the same time we need gpu based effects.

    However, as @hippocoder said no compute shaders isn't really a feature. And if you are going to release something, it's now or never because once the new render pipelines are stable, this is really not interesting.
     
  29. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Maybe, maybe not. I guess in the end what matters is that vfx look nice and that they run on your target platform. If the price is good, it's probably worth a try. I know that Unity is working on a new vfx pipeline, but from my experience with many new Unity features it will take a long time until it is ready to go.
     
    Mark_01 likes this.
  30. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,786
    What matters are specific things like are you bandwidth bound or not, plus things like culling which for large numbers of objects can only be done well on compute shaders. For a lot of PC games that push the envelope, compute shaders for stuff like this is almost required.
     
  31. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Well, Idk what to say other than it works :) You can try it out yourself when it's out, if you are curious. In terms of fill rate on older devices: Of course you can't have millions of particles. Even on PC overdraw will kill your performance if particles are too big. I'll run some test when it's done. But Im maxing out with Shuriken at 200.000 particles on a 6 core CPU. Why waste CPU time when you can have a low tech Particle system? Im sure this isn't for everyone. You have to see if this suits your project. TBH Im more interested in the technology and getting it to work. Also having an alternative GPU Particle System really isn't that bad, is it? ;D
     
    Mark_01 likes this.
  32. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,786
    I would definitely give it a try don't get me wrong, at least now until the new render pipelines are stable. Because there just aren't a lot of good choices.

    The render texture approach is not a bad one, it's just not as good as compute shaders. I've deal with the same scenario for water and animations, very similar situations. And render texture cpu cost adds up and it all goes on the main thread.

    That said I have no idea how efficient that part is for this system. I know for us being main thread cpu bound on stuff where there is no simple alternative, a ms counts as we are already under 60fps at design targets.
     
  33. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I think it is comparable with a blur post FX in terms of performance. Maybe a bit less. Of course this depends on the screen resolution / particle count. I'd say it's a premium effect in terms of appearance but also in terms of performance cost. On low end devices you can fall back to a super cheap effect. I think it is possible to automatically create a low end shuriken fallback. But that's a feature not ready yet.
     
  34. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Mark_01, Lars-Steenhoff and zyzyx like this.
  35. lightwaterjohn

    lightwaterjohn

    Joined:
    Nov 29, 2017
    Posts:
    10
    Just in time for Tetris Effect, which uses a particle a lot (Synesthesia Engine?) and may inspire designers to create similar experiences. Would be good to see a youtube video of the UI and examples.
     
  36. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I don't know what you are referring to. Got a link?
    I'll definitely create some videos about this, but I'd rather focus on functions and features while in Beta :)
     
    Mark_01 likes this.
  37. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    87
    Hi,

    I'm looking for a solution to render a good looking and performant tornado. Does this allow smoke materials for the particles?
     
  38. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey marcrem,

    You can use this to make an efficient tornado, but I would recommend to use UGS in a composition with other effects. I would handle a tornado something like this:

    1. Create a tubular mesh with an animated tiling texture tunning on it. This is the base of your Tornado.
    2. Add a layer of bigger particles on it that spin around the top and bottom of the tornado.
    3. Add debries flying around
    4. Add dust particles

    UGS can do most of this, but you will always get the best results in a composition of different techniques.

    BTW. The next update will include:
    • Animated sprite sheets with and without vector maps
    • Collision with planes
    • Burst modes
    • Surface shader support
    • Mesh emitter
    • Mesh target
    • Mesh particles
     
    o2co2 and Mark_01 like this.
  39. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    359
    I think this looks really good. I don't know for sure, but I think maybe many people do not
    want to have to deal with the new HD pipe line.

    Being able to have a alternative like this GPU Particle System , is a very good thing.
     
    MaxProude likes this.
  40. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    I figure it is a shot in the dark, but any idea if this is / would be able to be controlled and used by Slate - Cinematic Sequencer? Is there a way to easily start and stop the effects without having to do a fresh instantiation or enable/disable so it can be loaded in scene, just not actually doing anything at a particular moment such as a start/stop?
     
    Last edited: Nov 19, 2018
    MaxProude likes this.
  41. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Please do not let him fall like Hayate. I am tired of my many abandoned Assets. :mad:


    That said, it seems like a good product. He reminds me of your previous work..
     
    Last edited: Nov 19, 2018
    MaxProude likes this.
  42. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey ZJP,

    I deprecated Hayate, because all of its features were supported by Shuriken out of the box. There were also other assets like particle playground, that were killed by Unity. The built-in features are much faster than anything we could create, simply because they're native. Unity is improving its particle system over the next years, but I think it is going to be a massive and complicated tool to use. I hope that I can deliver the same performance and quality while making this system easy to use. If nothing else, it is still a great source to learn from.

    And thank you for remembering! :)
     
    ZJP and Mark_01 like this.
  43. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I have a couple of features to add and bugs to fix before I try out new things. Im pretty sure that would be a possibility, but it's probably also a lot of work.
     
  44. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    359
    Would this be able to do like fire / camp fire / candle ? the other effect would be smoke ?
    Sorry for the dumb questions, if there was a definition of something that is more noob .. that would be me with this.
     
    MaxProude likes this.
  45. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey Mark_01,

    Yes you can create fire smoke and sparks with this system. It really depends on how many particles you want to use. Lets say you want to have a realistic fire with sparks, you could use a sprite sheet animation as the core of the fire. Then add smoke (which could also be a sprite sheet animation in a different emitter) and sparks. If you want to use a lot of spark particles, this is where gpu particles really excellent and where I would r
     
    Mark_01 likes this.
  46. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hey Mark_01,

    Yes you can create fire, smoke and sparks with this system. It really depends on how many particles you want to use. Lets say you want to have a realistic fire with sparks, you could use a sprite sheet animation as the core of the fire. Then add smoke (which could also be a sprite sheet animation in a different emitter) and sparks. If you want to use a lot of spark particles, this is where gpu particles really excellent and where I would recommend to use UGS. For low end devices however, I would recommend the standard shuriken particle system.
     
    Mark_01 likes this.
  47. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    359
    Thank you for all of your replies :)

    My main reason for asking this, is for would this be good for VR ? I am desk top / windows only ... it is a hobby for me.
     
  48. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    84
    I haven't tested it yet, but I don't see why it shouldn't work. Especially with the new surface shader support which automatically compiles for your target built platform.
     
    Mark_01 likes this.
  49. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    573
    The biggest things that it would need are just exposed properties and methods, it can control anything that is exposed easily. So a way to instead of enable/disable (so that there is not the performance cost of and wait time) a way to easily just stop it from displaying particles and then a way to start it back up (or initially start it the first time, as the case may be).
     
    MaxProude likes this.
  50. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    359
    Any chance this will be in this round of black Friday specials :D or like last year they had a Xmas/New years sale I think it was :p

    Really tho the stated price now is good for me... Like others have said, I have had a bad luck of assets that
    are deprecated. I hate putting that on any dev .... It is just that after a time you end up being more careful even
    if there is no reason. IE ( this dev has been around in unity for a long time and has a good track record ) ..
    then I do not worry about an asset being " abandoned "

    In any case I will get this before the Jan deadline becasue I can see how good the potential is for
    [BETA] Ultimate GPU Particle System. Thank you.
     
    MaxProude likes this.