Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Particle Playground (Framework for controlling particles)

Discussion in 'Works In Progress - Archive' started by save, Oct 2, 2013.

  1. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    What's this?
    Particle Playground is a toolset which enables you to be creative in new ways in terms of altering and rendering particles in Unity. The framework enables a couple of different methods to emit particles as well as control them with different forces during their lifetime.

    Now released!
    http://u3d.as/5ZJ

    Important
    Please use this thread instead: http://forum.unity3d.com/threads/215154-Particle-Playground

    A new site is up showcasing the framework, try it out here: http://playground.polyfied.com/

    Feedback in the thread is more than welcome!

    $screen01.jpg
    $screen02.jpg
    $screen03.jpg
    $screen04.jpg
    $Skärmavbild 2013-11-29 kl. 23.58.52.png

    Previous:
    The last couple of days I've been working on a framework for controlling the Shuriken particle system, where you can pass in an image or mesh and rebuild it as particles with a pool (for performance).

    The particles follow something the framework calls states, a state can be looked at as a snapshot where position, color and size is stored. You can pass in an image or mesh with a couple of different parameters (for instance an image together with a depth map to give the image z-positions). Along with that you can additively add onto a state, where you for instance can store several meshes into one state. On top of this there are some tools built in for ease of use for the more common tasks, for instance linear interpolation (lerp) of a complete pixel2particle object; This makes it easy to blend between states, regardless whether they are images or meshes.

    These states are not compatible with animated skinned meshes in the scene due to their more complicated vertex access level - and the fact that they are live in the scene, therefore there's an extension for something the framework calls world objects and skinned world objects. A world object is a state live in the scene and computed in realtime, a good example is the skinned mesh emitter demo where the particles positions on every mesh vertex to fade towards their reuse in the particle pool.

    You can try it out here:
    Pixel2Particle images and meshes demo
    Pixel2Particle skinned mesh demo
    Pixel2Particle skinned mesh emitter demo
    Pixel2Particle depth mapping demo
    Pixel2Particle manipulators demo
    Keys: W zoom in, S zoom out, Mouse rotate

    The system now calculates particle behavior in its own Update cycle which makes it very handy to work with manipulator objects. You can try it out in the latest webplayer

    Are there any features you would like to see in it? I intend to release it in the near future when it's a bit more polished.



    [video=youtube_share;tOi9HiON_Vc]http://youtu.be/tOi9HiON_Vc



     
    Last edited: Dec 4, 2013
  2. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    689
    That's actually really cool. I can't say I have a use for it at all, but still pretty cool.

    Might be pretty cool to do something like this for a breaking glass effect.
     
  3. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks, yeah I'm not sure what I would use the actual implementation for as is either. :)
    I'm thinking perhaps evolving this towards being able to lerp through images and make the particles shift over time, maybe become meshes as well. Futuristic holographic workstation-ish. The actual use would perhaps fit better for medicinal or "scientific" purposes in the end.
     
    Last edited: Oct 2, 2013
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Meh... cool is cool, it doesn't need to have a practical application right away. ;)

    One thing that might be cool is if the pixels could generated from a texture on a mesh and positioned in space relative to the origin spot. You could use it to create effects like characters turning to dust or swirling or morphing between two things in a visually interesting way. This may be pretty expensive to do in real time on the fly.

    Very cool though. Look forward to seeing where this goes.
     
  5. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Very cool!! Love it. Yes could definitely be used as a transition state.
     
  6. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks guys, really nice feedback, I appreciate it. I like the idea of transition states, the layout isn't too far off from just an overload using several states as well, I'll go down that road and let you know what I find. ;)

    Placing them onto a mesh in regards of uv-mapping should be fully possible, it's a really good idea, have a hunch it will require some work though but worth digging into.

    It will be expensive for sure, perhaps I can implement a resolution, power of two downsize. I'll check that out as well.
     
    Last edited: Oct 2, 2013
  7. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    Wow that's really clever! :D

    Aside from using it for kickass transition effects (logos blowing away, images blasting into particles then reforming as another one etc) the first game-related idea I could think of was doing sci fi 3D billboards / displays. You could keep the pixel density deliberately coarse so it would look blocky when you approach it (like outdoor LED displays do, even though they look like TVs from far away) or even better, have the particles move out of the way when a character moves through them, kind of like a digital beaded curtain.

    Oh! Every time an explosion goes off, the pixels fall out of alignment then recover!
     
  8. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    That looks great!

    I'd like to be able to use Normal Maps with this to specify the z-depth of objects in the image. This could be used for creating true geometry from images instead of the faked geometry of shaders. It would probably require some pixel anti-aliasing to look solid, though.

    Taking that approach may also be the solution to creating a mesh. The mesh would be constructed along the color changes in the Normal Map, rather than making each pixel a vertex.
     
  9. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I had some time to work on an update tonight to implement functionality for texture arrays with transitions. What you basically could do now is to let the particles play a (short) movie. All it does is to create classes with information about each image, then there's a couple of helper functions and classes which lets you work through the different states.

    You can try it out here: http://www.polyfied.com/development/unity/pixeltoparticles/webplayer.html

    I'm thinking I would like to have manipulators to this as well, so you can interact with the particles a little bit more intuitive.


    I like the ideas, it's a bit expensive but when I get in an implementation for resolution it should be better fit for a game scene. Letting the player interact with the particles is something I'd really want as well in the end, I'll look into creating a couple of tools there. The good thing with having a pool of particles is... having a pool of particles :) but also very efficient when iterating through them and let algorithms take a hold of them.

    This sounds very interesting, I'm afraid I'll have to read up a bit on normal maps in general but it sounds intuitive and something you would want to be able to do. Heightmapping is just a z away. :)
     
  10. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Things are going quite well at the moment, but there's a lot to be done before this sees daylight. The most obvious addition is that states now handle meshes and/or images.



    Same link as before to see it in action (web player).

    Here's what I've been working on the last days:
    • Mesh support
    • States seamless to images and meshes
    • Heightmap support (nixter's request)
    • Resolution support
    • Size support
    • Possibility to add new images and meshes into existing Pixel2Particle system

    Future support:
    • Additive add (support for adding onto a state, for instance several meshes into one state)
    • Nondependent vertex mesh structure (need more points to particles)
    • Particle count scaling (rebuild particle pool according to current state positions - choice by user as a function)
    • Manipulators (tools for interacting with the particles, FlaxSycle's request)
    • Functions for moving and animated meshes (non-state realtime mesh update)
    • More example algorithms (for controlling the particles)


    What I struggle with now is the concept of adding particle positions of meshes, where some should be nondependent of vertices (nixter's request). In a perfect world I would like to structure the particles according to each vertex with a grid in between (I'm thinking some barycentric-ish solution) where each particle inside is colored as the calculated point for uv. Preferably with approximately the same distance independent of vertex positions. I have a lot to learn here, and I'm looking for input from someone experienced in this if you have the time! I guess it's what shaders commonly do in pixel shading (wild guess at the moment). I would also like to sort the mesh particles as the images pixel positions to get a better fluidity in transitions between meshes and images, but that's a later problem.
     
    Last edited: Oct 7, 2013
  11. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    That's pretty sweet!
     
  12. Myhijim

    Myhijim

    Joined:
    Jun 15, 2012
    Posts:
    1,148
    Tell me...

    When and HOW MUCH :D
    I am extremely interested. The random effect reminds me og Halo : Reach like loading screen.
     
  13. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Just finished up realtime skinned mesh support. This makes a particle able to follow an animated mesh in world coordinates.



    Test it in action here: Skinned mesh demo


    Glad you like it!

    Haha man, thanks. Well let's just see how this turns out. ;) I have high expectations of the final product so there might be a couple of iterations down the road.
     
  14. lancer

    lancer

    Joined:
    Aug 1, 2013
    Posts:
    231
    This look great!

    When is it going to be out????:confused:
     
  15. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Nice! My hopes are quite soon (can't really say an exact date atm), it depends a bit on how everything welds together. :)
     
  16. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    This last webplayer looks amazing....great job!!!
     
  17. wksDigitalArtist

    wksDigitalArtist

    Joined:
    Feb 1, 2013
    Posts:
    26
    Superb work! looks amazing, really great to see stuff like this.
     
  18. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks guys!

    I got a request from nixter to support depth maps, much similar to this example. I got in the functionality along with possibility to additively add on top of another state, but I'm unsure about the actual quality. Anyhow here's an image describing the method:



    And a webplayer demo showing the depth map implementation in action (not super exiting interactivity in this one...). The two images along with the depth map is mashed down into one state (which makes it able to lerp into other states as well).

    I'm thinking next up is manipulators to interact with particles. :)
     
    Last edited: Oct 8, 2013
  19. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    Fantastic! I can't wait to get my hands on this and try it out!
     
  20. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
  21. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Very nice. I like it alot. Could find many creative applications.

    -EDIT-

    Can particles get emmiting over time so that for example the robot is running and particles get emit as a trail?
     
  22. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I really want to implement it to work with DX11 as well, I'm not really there yet as a programmer but it has crossed my mind several times. It's exactly right for what this framework strive for and to be able to compute them on the GPU... would be amazing. I wasn't aware of bajeo88's project so thanks for sharing! Sometime in the future (perhaps not first release)!

    Thanks that's good to hear! The pool of particles is open to use as you want, but there are no helper functions for emitting extra "non-pooled" particles at time being. The main reason is that the particles need to be reused to stay efficient. I have a feeling that your request would be highly usable so I wrote a function which will modify a Vector3[] with all the vertex positions in world space. A quick example using a couple of lines of code will mimic emitting new particles when you actually reuse the addressed ones from the pool (which most of the time is preferable in any game). When a particle drops to zero it is reset towards the Vector3 array. It's just a nightly this one, something to improve later on for sure! Thanks for requesting, it makes the functionality way better.

    Check it out here: Skinned mesh emitter

     
  23. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thanks and nice! yes the example is like what I imagined. With high speed and size, it looks like the robot is on fire :) (regardless color)
    Cool stuff
     
  24. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    This is so awesome! I can't wait to buy this...great job!
     
  25. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    So I guess if the particles get the color from the pixels it will look like a ...weird motion blur effect or something, or even desindegration if we turn off robot. Just guessing :)
     
  26. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I like the expression robot on fire, how could that ever fail (unless you need the robot). :D

    Happy you like it! Hopefully you won't have to wait that long. I just really gotta make sure that it gets all attention in development that it needs. :)

    That sounds pretty much like what should happen, fun thing is that you could lerp into something else as well right after that happens (a robot angel with wings).
     
  27. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    You stole my words. ;)
     
  28. Kaemalux

    Kaemalux

    Joined:
    Aug 1, 2013
    Posts:
    45
    Wonderful! I do hope to see this on the Asset Store in near future!
     
  29. GeneBox

    GeneBox

    Joined:
    Nov 15, 2012
    Posts:
    480
    This is fantastic!
     
  30. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I'm testing for the functionality of manipulating particles in world space. Here's an example of using attractors and repellants:



    Try it here: Manipulators demo
    Choose which marble you want to emit (or all of them). While interacting with the marbles you'll notice that the black marble will attract particles and the white will repel them.

    This is still the same framework, it's just another way of using it - where you can still warp between states. These states however are world objects (similar to the skinned world object as seen in the robot demo) which has to be computed per vertex live in the scene.

    I want to wrap this nicely in a function where you get an attractor or repellant object, where you can push in calculation from these in all the other helper functions. I'm thinking that will be the path towards collision detection as well as I have to roll my own logic for that. Although collision detection per definition might not be possible due to the extreme amount, but repelling will (where I'm thinking of a possibility to reflect instead of linearly interpolate from position over time). So next up I'd like to write a velocity-handler as well which will open up for more fine tuning (for instance logic for wind). If you have any ideas or requests in this area make sure to shout! ;)

    Using this technique you'll be able to manipulate images per pixel, or just let a gameobject move through a field of particles where they would respond to the interaction.
     
  31. Myhijim

    Myhijim

    Joined:
    Jun 15, 2012
    Posts:
    1,148
    Jebus this just gets better and better! I love it!

    You are making me want to write my own, fail, then just buy this instead :D

    Myhi
     
  32. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks Myhi, well I would want to encourage you to develop your own, I've never learned so much about programming in such short time. :)
     
  33. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Really just freaking sweet. Awesome work. Watching the evolution is very cool. I'll happily purchase it when available.
     
  34. lancer

    lancer

    Joined:
    Aug 1, 2013
    Posts:
    231
    Is it going to be free?
     
  35. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks for the feedback! I'll try to keep up the ongoing documentation for the progress. :)

    I'm afraid it won't be free, but it won't be too expensive either. The pricing range will differ a bit depending on the quality of the final product so I can't give any price details right now. There's a lot to take into account here but it's important to me to evaluate something that is fair for the end user. Will let you know!
     
  36. ZJP

    ZJP

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

    Any news?
     
  37. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey ZJP, Thanks for asking! I'm currently implementing calculation of particles and inspector editing (the framework has only been accessible by script up till now). This has taken a lot of time but I'll soon be ready to showcase some new features. One nice addition I just added to vertex positioned particles is delta movement from last frame, what it does is to give velocity from the position the vertex had towards the current position. A good applicable example would be an object breaching water where each waterdrop's speed and direction would be calculated from the breach force.
    Give it a day or two and I'll have something to show. :)
     
  38. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Woo!. Nice addon. Thx for the reply. ;)
     
  39. sti4thewin

    sti4thewin

    Joined:
    Apr 21, 2013
    Posts:
    31
    This is amazing
     
  40. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Here's a tiny update with the current inspector for a PixelParticleSystem. No styling done yet.



    Currently developing this on my MacBook Pro 2011 model where 10 000 particles is still quite fluid thanks to the pool but hogs up the main thread quite a bit.

    The Source is the initial positioning for a spawned particle, the classifications today are:
    • State - Target each position and color in a recorded state (an image's pixels for instance)
    • WorldObject - Target each vertex in a mesh
    • SkinnedWorldObject - Target each vertex in a skinned mesh
    • Script - Behavior controlled by custom user scripts

    As you can see I've managed to add some features similar to the native Shuriken system, for instance color and size over time. Size over time multiplies a size-list for each particle determined by sizeMin and sizeMax (which makes random sizes between a minimum and maximum value over time possible). Initial Local Velocity is the velocity from each particle's normal direction from a World Object (mesh/skinned mesh in the scene).

    I'm also exploring the possibilities to add event objects into the scene which can control the particles more intuitively from a trigger collider or a keypress. Not sure if this will make it to first release.
    There were a lot of restructuring when this went to become a visual tool in the editor, that's what's taking time right now. I'd also want to make a visual wrapper for adding a state where you can additively add onto them etc. and expose most of the script features from the framework.

    No webplayer this update, soon! :)
     
  41. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Very impressive again!!! Would be very interesting to see what can happen with magnet and gravitational forces to this...to create vortex's etc.
     
  42. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks pixelsteam! Your ideas gave me some inspiration to do a nightly demo. Here are some of the features showing off. Finally got out a webplayer as well. :) I'll continue to work on this with manipulators (magnets), it's good to have a standard sandbox to try out all the features.



    Webplayer

    Keys: Mouse movement punch system in direction, Space elevate system, WASD rotate

    Full screen is preferred for performance, let me know if you find any anomalies!
     
    Last edited: Oct 22, 2013
  43. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744


    The system now calculates manipulators in its own Update cycle which makes it very handy to work with manipulator objects from the Inspector.

    You can try it out in the webplayer. The manipulator is represented by a black sphere when turned on and all particles within range will be affected by it.


    I'm also working on serialization and copying of a particle system to be able to work with them more effectively (for instance be able to store the current state to disk or just multiply an existing).
     
    Last edited: Oct 22, 2013
  44. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Here's a video of the particles in action for the ones on mobile devices not being able to try it out. Sorry about the quality, had lag in the recorded videos on full 1080 so I had to half the resolution.

    [video=youtube_share;tOi9HiON_Vc]http://youtu.be/tOi9HiON_Vc

    I really want to go down the Dx11 road on this. Name isn't that suitable anymore but perhaps it works anyway, what do you think? Been thinking about something like "Particle Playground".
     
  45. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    DX x11 support would be fantastic! Obviously there would have to be fallback support for mobile, but the performance boost of using GPU rendering would be substantial.

    "Particle Playground" sounds like a fine name to me. :)
     
  46. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    @OP

    I hesitate between your product and Hayate (Maybe I'll take both). Do you have an ETA and what about the price?
     
  47. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    That is insanely cool! I wasn't aware of Hayate, thanks for sharing. The frameworks seem to have a couple of similarities for sure. As far as I can tell the intentions of controlling the particles seem a bit different, Pixel2Particle (which is the working title) also handles animated skinned meshes but that is probably just an update away in Hayate. In best defense for me and MaxProud I think you'd gain from both frameworks but for different uses. :)

    I'm aiming for making it release ready and upload in late November (approx. one month) and I think the first release price will be set around $30.

    Lately I've been working on different types of manipulator objects, one that simulates gravitational forces (previous shown one attracted particles in a funnel). I'll also quite soon be wrapping up the first version, write documentation, make some elaborative example scenes and setup a website.

     
    Last edited: Oct 28, 2013
  48. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the reply. Indeed, yours and Hayate have different use.
    Good news. :D
     
  49. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Good stuff! It'll hopefully become a bit more clear when there's a documentation what the framework is capable of. :)

    The tiny addition tonight is the extension class Vector3AnimationCurve, which enables additional velocity over a particle's lifetime through curves in X, Y and Z values. With this you're for instance able to do movement patterns for the particles.

    Emitting from sphere in X and Z


    Emitting from sphere in X only


    Hopefully it'll bring high level of control where the velocity patterns are easy to alter.
     
    Last edited: Oct 28, 2013
  50. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Got in a first version of collision detection. It runs in the Update cycle where each particle is calculated against the scene's collision mesh normals within range. It's currently using overlapsphere and raycasting where it'll finally reflect the current velocity towards the colliding normal. I also added a bounciness feature and object masking. What I envisioned was realtime collision from animated characters for instance, using this technique will hopefully keep collisions possible no matter the circumstance.
    It is quite fast at the moment where in the image 9 000 particles runs fluidly on my laptop, but I'll continue to evolve and optimize this part in the future.