Search Unity

PA Particle Field - Superfast, GPU Based, Persistent Particles

Discussion in 'Assets and Asset Store' started by popupAsylum, Apr 17, 2015.

  1. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119

    PA Particle Field is a GPU Based alternative particle system, built from scratch specifically designed for looping ambient effects (though it can do so much more). Built to reduce drawcalls, fillrate and CPU overhead (especially on mobile devices), each field supports up to 16250 particles with just 1 drawcall and can be fully customized.

    Get it on the Asset Store: http://u3d.as/content/popup-asylum/pa-particle-field
    Try the Web Demos: http://www.popupasylum.co.uk/paparticlefield/
    Check out the Animated Documentation: http://www.popupasylum.co.uk/paparticlefield/documentation

    Features:
    • New Mesh Particles
    • WorldSpace and LocalSpace simulation
    • Streched billboards
    • Custom facing direction
    • Multiple sprites in a single field (using a spritesheet)
    • Spritesheet animation
    • Per particle color
    • Custom shader support with helpful macros
    Also Exclusion Zones allow you to exclude particles from areas and assign priority between them, useful for bus shelters in the rain etc. Each field can handle 3 Exclusion Zones at once and are assigned and handled automatically.

    The package comes with 10 demo scenes:
    Snow, Clouds, Caustics, Rain, Stardust, Bokeh, Mesh Particles, Animated Mesh Particles plus a custom vertex program demo and a comparison scene showing PA Particle Field handling 195000 particles with ease.

    PA Particle Field manages its efficiency by getting rid of particle birth and death. Instead it recycles particles using a bounding box, when a particle reaches the edge of the box it reappears on the opposite side.

    When simulating in worldspace (the default mode) the field can be moved without moving the particles it controls, giving the effect of simply revealing the particles at the new position, creating the illusion of an infinite particle field.

    FAQ
    Can I preview the particles' movement without pressing 'Play'?
    Yes, at the top of the Scene window is a drop down with effects, to preview the animation turn on 'Animated Materials'.

    How can it be used with multiple cameras/players?
    There are several solutions, create one large field or create a field for each player and give each a unique layer.

    Can I use customized particle shaders with this package?
    Yes, you can write your own shaders and there are several macros provided to help. See http://popupasylum.co.uk/?p=683 for a tutorial.

    Can I rotate the field in worldspace mode?
    No, this is a limitation of the system (rotating the field would cause a particle to exist and be displayed in multiple places at once), I am considering solutions but have no expected time frame. You can always rotate the field in local space.
     
    Last edited: Sep 20, 2015
    ikemen_blueD, GCatz and shkar-noori like this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    web demos black box, broken?
     
  3. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    weird, it should show a black box with a white play button, after its clicked it should open the caustics demo
    Its working for me, its been built with Unity 4.6.3
    Untitled-1.jpg
     
  4. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
  5. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    "Designed to reduce drawcalls, fillrate and CPU overhead on mobile devices". Can you further explain it? That sounds super interesting. Fillrate is the mobile's biggest enemy, especially when dealing with Particles. How can I solve Fillrate issue with your system? What main advantage of your system, compare to Shuriken, Particle Playground?
     
  6. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    The particles are generated once on the CPU (unless certain properties change such as the number of particles) then the rest is handled in the shaders. This allows the fields to handle lots more particles, so where previously you might have used larger particles to simulate a dense volume causing plenty of overdraw you can instead use a field with many more small particles which usually leads to less overdraw and a better looking effect.

    It's a different way of thinking about particle effects compared to Shuriken and Particle Playground. PA Particle Fields swap the usual "lifetime" property for a bounding box, when they reach the bounds they are recycled to the opposite side. This makes it great for persistent looping events, for example you wouldn't use a field for a one shot explosion, but you might for chimney smoke.
     
  7. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    thanks for your reply. Some last questions, from what I understand, your Particle system, behaves like a Pooling system, generates and reuses lots of small particles. Since particles are small, less Overdraws happen. Is it right? What about the cost of simulating lost of small particles, moving around in the screen? Is there a way I can bake lots of small particles movement into a sprite sheet animation?
     
  8. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Yeah it acts a bit like a pooling system, once you've set the particle count that number is then fixed, with PA Particle Field there's always exactly the same number of particles every frame.

    Yeah that's right, the cost of moving the particles is on the GPU it's very fast, so you can have more smaller particles with less overdraw.

    PA Particle Field supports sprite based animation but doesn't have tools to generate sprites, what sort of effect did you have in mind for it?
     
  9. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Recently, I'm trying to figure out the best way to use the most out of particle system, with the cheapest cost possible. So that, I could use more particle effects. Your system could fit my needs. I will do more findings before deciding to buy your system. Anyway, thanks for your answers :)
     
  10. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    PA Particle Field 1.1 released!

    What's new?
    Exclusion Zones extend PA Particle Fields usefulness, these are bounding boxes where particles will not be shown, e.g. With a rain field parented to the camera, rooms and indoor areas could be excluded.
    Custom Material/Shader Support allows you to extend the functionality of PA Particle Field in whatever way you need using a few built in macros.
    Reduced Shader Size as editor only features no longer add to the compiled shader.

    Plus New Demos to show off the latest effects.


    Also check out Apnea by @LucaMefisto who used PA Particle Field to take his VRJam game from 10 fps to 50 fps!
     
  11. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Here's whats coming up in PA Particle Field 1.2:

    Volumetric Cloud Demos
    show off what can be achieved with high end artwork, and includes 9 reusable cloud prefabs.
    Mesh Particles expand on the usefulness of PA Particle Field, allowing you to simulate hundreds to thousands of meshes in a single drawcall
    Plus optimizations and bug fixes

    And here's a quick example of what Mesh Particles can do, 300 Asteroids with individual sizes, speeds and rotations in 1 drawcall, with PBR and normal maps running at 1000 fps on a Geforce GTX 580

     
    Last edited: Jul 14, 2015
    Marble and gurayg like this.
  12. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Works on DX9?
     
  13. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Yep, the current version 1.1.21 runs on DX9 and even OpenGL ES 2.0 and will do for all foreseeable future versions including 1.2, the latest release added Wii U support.
     
    ZJP likes this.
  14. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the reply. :cool:
     
  15. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    Looks amazing. I will definitely be grabbing this.
     
  16. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Just putting the last demo for 1.2 together before resubmitting it, got some animated mesh particles going, using the warrior asset from our free SciFi Enemies and Vehicles pack (cross promotion!)


    Quick note in case anyone gets too excited, the legs are being moved in the shader using a sine wave, not using the rigged/boned animations that come with the free pack, skinned mesh particles should be possible though and might make it into a future update
     
    hippocoder, DrewMedina and ZJP like this.
  17. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Thought I'd also mention v1.2 will also improve the re-usability of the included demo assets, making them more useful outside of the demo scenes.
     
    Marble and hopeful like this.
  18. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    The v1.2 Demo scenes are now up at www.popupasylum.co.uk/paparticlefield

    Along with the webplayer version it also includes downloadable versions for PC, Mac and even Android, the mesh particles run great on my Adrino 225 phone, I'll probably turn off the realtime shadows off on Android though

    And you'll need a pretty beasty phone to run the comparison scene, the 195000 shruiken particles are extermely heavy (the 195000 PA Particles are fine though)
     
    Last edited: Aug 14, 2015
  19. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Cool
     
    popupAsylum likes this.
  20. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Very nice demos and possibility. How about the ETA for the 1.2?. :cool:
     
  21. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    I actually submitted it to the asset store 2 days ago so should be pretty soon, I'm checking pretty regularly as well because it's normally available for a while before I receive the approved message.
     
  22. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Coolest feature by far is the lit particles, this asset blows my mind. Totally getting my boss to buy this!
     
  23. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Loving this. I would like to request a feature, Turblulance. Another GPU tech has it as well as vector field support, but that tech got abonded. Maybe your moment to replace it!
    So far your PA particles are really great, im using them parented to my player and its just so cool to have it move with me and work correctly in world space.


    Thanks
     
    Last edited: Aug 15, 2015
  24. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Looks like 1.2 is live!
    Can you please explain how you set up your bug anim? I see you painted using vert coloring, how is that implemented? looks cool...The clouds are really nice too
     
    Last edited: Aug 15, 2015
  25. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Yeah turbulence is definitely the next priority, just looking for the most optimal way to implement it, I hadn't considered them but Vector Fields could be a nice solution!

    Glad you asked! The bugs are an example of using a customized "Warrior" PA Particle Field Mesh shader that manipulates verts using sine waves.

    Firstly the mesh has vertex colors;
    Red defines the amplitude of the wave and is set up as a gradient from black at the base of the legs to full red at the knees and toes
    Green defines a per leg start time offset, alternate legs have an empty green channel
    Blue defines a full body start time offset, and is set to 1 on all verts.
    These were authored in Maya using a second UV set, a texture containing the gradients and the Import Attributes tool.

    The shader is a surface shader with a vertex function. A z position offset is calculated using a sine wave multiplied by the red vertex color, offset by the green and blue.

    Code (CSharp):
    1. float sinTime = sin(_Time.w * _MoveSpeed + v.color.g * 4 + v.color.b * 4);
    2. v.vertex.z += sinTime * v.color.r * 0.01;
    This moves the legs forward and backward, moving very little at the base and fully at the knee and toe.

    A second offset sine wave is then applied to y, by clamping the offset to (0,1) range the y motion appears to stop when it hits the floor

    Code (CSharp):
    1. sinTime = clamp(sin(_Time.w * _MoveSpeed + 1 + v.color.g * 4 + v.color.b * 4), 0, 1);
    2. v.vertex.y += sinTime * v.color.r * 0.01;
    So far this is all still local space, and the model is still at its origin, the PA Particle Field methods move and orient the particles around the field.

    Code (CSharp):
    1. PAParticleMeshField(v);
    2. v.vertex = PAPositionVertexSurf(v.vertex);
    These are the 2 functions that make PA Particle Field work.

    Lastly, currently all the bugs are moving their legs in sync, PA Particle Field multiplies color variation over the existing vertex color, by putting a color variation gradient on the field with r and g set to 1 and blue going from 0 to 1, each bug gets their own vertex color b time offset so they aren't in sync.

    The "Warrior" shader also has a few multi_compiles removed for faster building.

    And that's it, I'll write this up properly with pics on the Popup Asylum blog
     
    ZJP and gurayg like this.
  26. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    How do I contact you? No PM option... I have some info that might help with turbulence drew@headtripgames.com
    thanks for the breakdown on the shader setup, trying it soon!

     
    Last edited: Aug 15, 2015
  27. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    you are not kidding! It just improved my games look dramatically.
     
    popupAsylum likes this.
  28. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    The general inquiry email address is info@popupasylum.co.uk, for PAPF stuff that can probably go straight to me at mark@popupasylum.co.uk, I've sent you an email as well
     
  29. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Ha! Cheers, I probably ought to add a demo scene specifically for showing that feature off
     
    hopeful likes this.
  30. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    As a big fan of Particles Playground that would be interesting if your tools are working together ..
     
  31. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Not going to say no for sure, there could be some crossover, but Particle Playground is based on the Shuriken system and PA Particle Field is very intentionally not, but there's also no reason that you couldn't use both in a project
     
  32. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    That's what i planned to do. Absolutely love Animated Mesh Particles :p
     
    popupAsylum likes this.
  33. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Ah in that case that's perfect ;)
     
    ZJP likes this.
  34. Mephesto_Khaan

    Mephesto_Khaan

    Joined:
    Jun 2, 2013
    Posts:
    47
    Incredible asset! I used it for my VR Game Apnea (http://vrjam.devpost.com/submissions/36764-apnea) and this was the only way I could have proper seaweed, goodrays, specks etc... all running in VR at 60 fps.

    I will for sure post some animated gifs of my custom PAPF seaweed with animations! But everytime I do a video it's soo dark
     
  35. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Cheers! Some very cool uses of PA Particle Field in there, lots of ways I would never have guessed anyone to use it!
     
  36. Mephesto_Khaan

    Mephesto_Khaan

    Joined:
    Jun 2, 2013
    Posts:
    47
    Hope the image it's not too dark! I am using PAParticleField so I can render the seaweed in my underwater game.

    It is going great so far, extremely low impact compared to the terrain grass (just 1 drawcall per seaweed cluster...) I just edited the shader so it animated with the wind, adjust to the terrain height automatically and shines with caustics (not in that gif because is scene view)... pretty straight forward!

    One of the things I have found is that the particles are not affected by fog, so I tinted them with the fog color manually (based on distance to the camera). But since I can tweak anything at the shader level I can configure it to my likes

    The goodrays-meshes in the background are also PAPF by the way....
     
    ftejada likes this.
  37. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    The blog explaining how the Warrior demo scene was put together is up:


    It shows how the mesh and vertex colors were set up and goes into customizing the Mesh Particle shader

     
    Last edited: Sep 17, 2015
    DrewMedina likes this.
  38. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Excellent!! Thanks
     
  39. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    PA Particle Field 1.2.1's now on the store!

    What's new?
    Unity 4.3+ and 4.6+ support for Mesh Particles
    Reduced memory across all platforms

    For people using custom shaders some keywords have changed as well;

    Added
    EDGE_SCALE_ALPHA - allows particles to scale and fade at boundary edges
    LIGHTING_ON - allows particles with forward passes to use lighting (previously unlit shaders still did some unnecessary calculations)

    Removed
    EDGE_SCALE_OFF - Edge scaling is now off by default and can be enabled using edge_scale_on or edge_scale_alpha
    EDGE_ALPHA_OFF - Edge alpha is now off by default and can be enabled using edge_alpha_on or edge_scale_alpha
    USER_FACING_DIRECTION - Feature still works, just no longer requires a #define
     
    Last edited: Sep 18, 2015
    Marble likes this.
  40. CarpeFunSoftware

    CarpeFunSoftware

    Joined:
    May 7, 2015
    Posts:
    34
    Nice Asset! Thank you for writing it. :) Very performant so far.

    Wanna talk about this?
    :(

    :D ;) The local stuff is all :) :) :) :)

    P.S. I would LOVE to have world-space rotation working.
     
    DrewMedina likes this.
  41. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    For world space position when the field moves, the particles maintain their world space position (unless they leave the field bounds and are repositioned) . For world space rotation I'd want the particles to keep their positions as well, the problem is the final position of the particle is very dependant on the Axis Aligned Bounding Box of the field and basically modifying that by rotating it has a massive affect on the position.

    It's only noticeable while it's turning, once it's stopped rotating everything works as normal no matter what it's end orientation is. Maybe I could enable it as a bit of an experimental thing, could be useful for some wacky effects. I set it up basically ignoring it's rotation mostly for effects parented to the camera.

    I'm very interested in what effect you're using it for? Particularly if it would benefit from world space rotation
     
    CarpeFunSoftware likes this.
  42. CarpeFunSoftware

    CarpeFunSoftware

    Joined:
    May 7, 2015
    Posts:
    34
    As to the rotation effecting stuff, sure. I would have guessed that if you apply location transforms, you also apply rotation transforms. (one quaternion) I assume you'd have emit issues to solve for rotating fields. In a world-space system, the particle would be unaffected by rotation unless it ended up outside the bounds. Now, IDK the realities of your storage format and data... so maybe that's a "big hit" for you.

    As to how used, I can't say exactly, but I'll give you a close analogy.

    Let's say I had a game with a magic-user and he threw 5 fireballs in rapid succession. These fireballs are each composed of a few PAPF's (think one local-space square one for a "ball", one or two local-space long-and-narrow fields for trails). Using local space right now lets me move everything at any vector. As you can imagine, the particles don't move at exactly the same speed as the projectile ball. I apply a force to slow them a bit so the trail "moves"

    Local space, however, causes problems. For example, once the fireball 'hits" a target, I stop moving the field. Well, because I'm using local-space, I have to adjust the force vector for the field since I'm no longer moving it. Example, if the magic users threw a fireball at the camera (that is looking down the z axis) I can have a moving field moving toward the camera with a velocity of 50, with a force of -10 on the trail(s)...so the fireball comes at the camera at v=50 and the trail is moving at V=40. But once the field stops, (V=0) I have to adjust the trail particle force (or maybe speed) since they should still move at V=40 (because I want world space moment, not local field). I also fade them out somehow (I'm actually reducing count right now). Now, try doing that at a 45 degree angle to the viewer. Or whatever angle.

    It's just extra work to apply delta-V's to everything that I wouldn't have to do in world-space. Now, I do have to worry about field size and position and sweeping-clipping. Sure. I'm actually rather surprised to you don't have a dedicated emitter, but that's another topic and I don't want to get off-track.

    Basically my delta-adjust-force method works if everything is moving in a straight-line...I couldn't really "curve" such a field around without rotation, or bounce it off stuff and get a new vector. I guess I could always create a new field for a new vector after a bounce, but that still doesn't handle "the curve ball". I'm aware that's not a precise analogy, and that rotating the field would clip stuff in a "sweep". But you get the need for delta-adjustments due to using local-space vs world-space.

    I hope that made sense.
     
    Last edited: Sep 20, 2015
  43. CarpeFunSoftware

    CarpeFunSoftware

    Joined:
    May 7, 2015
    Posts:
    34
    P.S.
    I was after a GPU based system. I guess I should have realized that this was more of a "static field" type of system (think rain).

    There isn't much if any difference between local-space and world space if you never move the field. However, if you want to give the field a rotation, and particularly if you re-use objects as in an object-pooling situation with arbitrary movement and rotation vectors, you currently need to use use local-space and deltas to make-it-seem more like world-space in the current implementation.

    I assume the main issue is memory limits and mobile platforms....and that you're storing particle data relative to the field rather than world-space to avoid large floats? I admit I haven't dug into the code though. I assume that, because if you were already using world-space, rotation would be "free/cheap".

    I'm not an expert, but I'd guess (just talking/discussing here) that anyone implementing a gpu PS has a few options:
    1) Have different shaders for local-field and world-field.
    2) Build smarts into a single shader that could do either efficiently, storing the data differently depending on type.
    3) Pick a method for storing particle location, either world-relative or field-relative, and bite-the-bullet (and get a lot of maths impact) on adjusting stuff if they pick the "other" option that differs from storage-format (but only when the field moves).
    4) It's all just a 3D transform, pre-calced for the frame, everything is stored relative to either the world-origin or the field. Moving a local-space field is just a different transform than if you move the field in world-space. There's always a local-to-world transform that can be calculated. And the reverse too.
     
    Last edited: Sep 20, 2015
  44. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Ah yeah being able to rotate in that situation is obviously required, I'll add it as another simulation space option, something like "world space rotatable". It should be able to reproduce what you're doing with delta forces on the shader side where position is world space and rotation is local space, another tool in the arsenal at least.
     
  45. CarpeFunSoftware

    CarpeFunSoftware

    Joined:
    May 7, 2015
    Posts:
    34
    Thank you very much. :)
    Good support! :)
     
  46. CarpeFunSoftware

    CarpeFunSoftware

    Joined:
    May 7, 2015
    Posts:
    34
    The question I have is....is there a huge performance impact one way or the other? Maybe it's "just another transform" so it's a wash. Or maybe you have to do more work to "fix up" the locations.

    I'd want to have a general idea of how it impacts stuff. Maybe I should just go dig into the code...

    (mostly thinking out loud here)
     
  47. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    At the moment, in the built in billboard particle shaders its 1 extra transform for local space, for getting the world space camera position in local space, a final transform is performed for both world and local, either view projection or model view projection.

    For the built in mesh particle shader its an extra transform in world space mode, it's a surface shader and in Unity's compiled shader they do an MVP transform, so world space particles must be transformed into local space before that.
     
    CarpeFunSoftware likes this.
  48. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Here's whats coming up in PA Particle Field 1.3:

    World Space Rotatable
    simulation space allows fields to recycle particles in world space but rotate in local space [added in v1.22]
    Pre-Cache Option allows users to decide if the particle mesh should be cached from the editor or generated at runtime, caching results in a faster start time but a larger file size while generating at runtime has a longer start up time but very low file size.
    [added in v1.22]
    More Mesh Particle Options, camera facing mesh particles and multiple mesh inputs
     
    Last edited: Dec 29, 2015
  49. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    Just bought this and I find it to be pretty cool. Is 1.3 coming? I could use the pre caching since I want to bring load times down and I don't really care about filesize that much.
     
  50. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Hi @AcidArrow, glad your finding PAPF cool!
    1.3 is indeed coming but in the meantime 1.23 went on the asset store yesterday and the precache option went into version 1.22, and precache is on by default so it should be working for you
    are you seeing long start times when using PAPF? To test without caching tick the "Rebuild at runtime" checkbox