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

Hydra Particles - A new particle sytem for Unity3D

Discussion in 'Works In Progress - Archive' started by VesuvianPrime, Aug 17, 2014.

  1. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    Amazing work! Keep it up
     
    VesuvianPrime likes this.
  2. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Excellent thanks for the reply.

    I could use for the effects on top of the water for surface effects under a basic body of water. Perfect. :)
     
    VesuvianPrime likes this.
  3. perracolabs

    perracolabs

    Joined:
    Apr 3, 2014
    Posts:
    29
    Quite a impressive (mind blowing) jump on performance compared to the initial apk
    Again tested on a Samsung Galaxy S3 with APK v0.2.0, will test on other devices when I get a bit more of time.

    The results are:
    600 particles at 60FPS
    900 particles at 60FPS
    1200 particles at 35FPS
    1500 particles at 25FPS
    1800 particles at 20FPS
    2100 particles at 15FPS

    Between 600 and 1500 particles it runs pretty smooth, even when at 25FPS. Nevertheless for a mobile device 600 particles on screen are already a lot of particles, and at the current performance speed is truly top notch.

    Surprisingly and contrary to what I was expecting, when activating the collider it doesn't slow down at all the performance.
     
    VesuvianPrime likes this.
  4. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Thank you! I was worried it would be too slow, but if you're happy with that speed then so am I.

    How do you want credited?

     
  5. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    So, besides another pile of bugfixes, the past few days I've reimplemented the way we handle color:



    You're able to add a bunch of different "layers" which all contribute to the final particle color. Currently there are a few different contribution modes:
    • Lifetime
    • Speed
    • Camera proximity
    Color over lifetime (video)


    We're coming very close to our first release!
     
    rakkarage and AndyNeoman like this.
  6. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    As a heads up, my colleague Jazz (who has been working on the conceptual side of things) has been maintaining a blog outlining the development of Hydra Particles:

    http://jazzcmoore.blogspot.co.uk/

    Jazz is much better at explaining things from an artists perspective, so you may find her blog useful if you're tired of my programmer art!
     
  7. calmcarrots

    calmcarrots

    Joined:
    Mar 7, 2014
    Posts:
    654
    1. You're gorgeous
    2. I will be testing this out too soon (I have an s3 too)
    3. To OP, your particle system is very nice!
     
    VesuvianPrime likes this.
  8. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    591
    is there any link to try out this amazing stuff ?
     
  9. Cytobellum

    Cytobellum

    Joined:
    Oct 15, 2014
    Posts:
    1
    This is amazing because it happens to be exactly what my game is missing! I will definitely download this when it is available. I hope the release is soon. Thanks and good luck!
     
    VesuvianPrime likes this.
  10. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Thanks guys

    Blackbird, you can find the web demo here and the android demo here. Currently this is just a stress test for your device. Hopefully Jazz can throw together some more exciting examples.

    We'll be feature complete (for version 1) in a day or two. The next week will mostly be documentation, videos and promotional material before we hit the asset store!
     
  11. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Point cloud!

     
    twoc46 likes this.
  12. twoc46

    twoc46

    Joined:
    Jul 10, 2012
    Posts:
    7
    Awesome progress guys, I have come across another little (Maybe not little) suggestion, primarily particle attractors.



    I know that it is possible to create an attractor in unity but it would be nice if it was all put into a nice little package.

    One more thing , have you guys come up with a price yet?

    Keep it up guys!
     
  13. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Hey twoc46!

    Currently we have two different types of attractors:

    Gravity Well (velocity gradually increases in the direction of the force)


    Target (speed remains constant, but velocity rotates towards the force)


    All of the Hydra forces can be configured with different falloff types, radii and intensities:


    But perhaps you're looking for a different type of attractor? It's trivial to write new forces and add them to existing systems.

    As for price, we're currently aiming for around $60 based on the Asset Store publisher guide.

    This package includes:
    • HydraParticles: the full project, all open source.
    • Some goodies like particle textures and vertex color shaders.
    • HydraCommon: a submodule we use on all Hydra projects, containing all of our maths optimizations, editor extensions, bezier classes, etc.
    Naturally you'd also be getting a lifetime of support and updates.

    We've made some headway on resources like documentation, examples, tutorials and videos.
     
    rakkarage and twoc46 like this.
  14. twoc46

    twoc46

    Joined:
    Jul 10, 2012
    Posts:
    7
    Awesome man, This is just what I needed thanks again.
     
    VesuvianPrime likes this.
  15. meteory.liu

    meteory.liu

    Joined:
    Jul 25, 2014
    Posts:
    2
    Awesome! Im look a long time for this. I hope the release is soon. Thanks a lot!
     
    VesuvianPrime likes this.
  16. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    is it possible to change/offset per particle pivot point? for example :
    Say you have a fire particle using sprite sheet texture (quick search from google Link) you need to have the particle pivot right at the bottom of the sprite, currently in shuriken the pivot are in the center of the billboard.
     
    Last edited: Oct 30, 2014
    VesuvianPrime likes this.
  17. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Not a bad idea Rea

    Earlier in the thread I did that test with the rain-drop particles. I can absolutely see the value of adding a pivot offset. Should be able to get it done in a short amount of time.

    Thanks,
    Ves
     
    Reanimate_L likes this.
  18. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    It would be awesome, it usefull especially combined with attractor/forcefield. Might want to check on Farcry fire effect they utilize particle billboard pivot shift a lot for their forest burning effect. :)
     
  19. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
  20. SirStompsalot

    SirStompsalot

    Joined:
    Sep 28, 2013
    Posts:
    112
    Man. Fire simulation would be slick.
     
  21. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    well no need to go that far i guess, just having pivot shift/offset would be awesome :)
     
  22. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Reanimate_L likes this.
  23. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Nice....that was fast.....wow
     
    VesuvianPrime likes this.
  24. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    When do we can test Hydra? is there a repo/place to download it?
     
  25. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    You can find the performance test here.

    No plans for releasing code for testing. I have a few friends throwing bugs at me (everything is actually very stable at this point). We're also making examples, videos and documentation to show how everything works.
     
  26. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Got bored, so I decided to write an API that abstracts 2D/3D raycasting. This allows them to be used interchangably, or at the same time!

    (video)


    Also, for promo stuff, I figured it would be nice to be able to render pngs directly from a camera inside Unity:



    Takes some pretty nice pictures!

     
  27. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Can now configure particles to have a radius for collision detection:

    (video)


    Collision detection can also now factor in the physics material of the collider for bounciness.
     
  28. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Fixed the bounce equation so now particles don't lose their velocity along the surface.

    (video)


    Next on my hitlist is friction.
     
  29. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Friction now working

    (video)
     
    twoc46 likes this.
  30. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Finally implemented mesh emission. Not sure why I put it off so long.

    (video)


    I've implemented Shuriken style emission: using the centroid of the vert/edge/triangle for the position and velocity of the particle.

    But then I figured this is going to suck when I want to do grass generation, fire spread, etc. So I added a mode where randomly distributed points on the mesh are used with interpolated normals:

    (video)


    This means that mesh emission is no longer dependent on high resolution meshes for a nice distribution!

    (video)
     
    Last edited: Nov 4, 2014
  31. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Was worried about the performance of the wireframe handles, so I spent some time today fixing that up.

    I learned 2 things:
    1. You can use GL methods to draw things inside OnSceneGUI
    2. You get a MASSIVE performance increase if you simply check if Unity is repainting.
    Code (CSharp):
    1. if (Event.current.type != EventType.Repaint)
    2.     return;
    So we can draw some nice wireframes in the SceneView without worrying about exotic shaders.

     
  32. Major

    Major

    Joined:
    Jul 26, 2012
    Posts:
    69
    This is a little late but one annoying limitation with the build in Unity systems is that you can't detect exactly where one of the particles hit. This is useful for setting up bullet systems using particles. Unity's build in particles can travel at insane speeds and still have collision detection but beyond that you can't do anything. Anyways what I am saying, and asking is, it would be useful to have the ability to detect where a particle hits in the world space, or local space. I'm also wondering can the particles in this system travel very fast and detect collision correctly?
     
  33. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Hi Major, apologies for the belated reply!

    These past couple weeks I've migrated to USA and sorted out marriage license stuff, so that's why I've been inactive for a while. Regardless, I'm always happy to hear people's input.

    I'm pretty happy with where the collision detection is right now. I wrote a wrapper API that treats 2D and 3D collisions identically, so we're in a very solid place to start calling collision events with all of the data you would expect.

    Regarding speed, I think high velocities should work without issue. We do a spherecast the length of the velocity, so I'm more interested in seeing how things cope at slower speeds.

    I'll do some work tomorrow and see if I can get the events implemented properly.

    Thanks,
    Ves
     
  34. Major

    Major

    Joined:
    Jul 26, 2012
    Posts:
    69
    When you say all the data you would expect, does that mean data from something like a raycast? Since you are using spherecasts.
     
  35. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Absolutely. Things like the GameObject, the Collider, PhysicsMaterial, etc.

    It was driving me crazy that circlecast gives a centroid but spherecast does not, so I added that functionality too.
     
  36. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
  37. Major

    Major

    Joined:
    Jul 26, 2012
    Posts:
    69
  38. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Collision events are implemented, albeit nothing visual to show off.

    Currently working on prefab override logic in the editor.

    As for examples/tutorials/promo work I need to start beating my colleagues with a stick.
     
  39. Major

    Major

    Joined:
    Jul 26, 2012
    Posts:
    69
    By the way, when do you think an alpha or beta will be out?
     
  40. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    What would you expect from a beta? Access to the source?

    I'm eager to get this package onto the asset store a soon as possible. I'm not sure how to distribute an open beta without people exploiting it, especially as the whole thing is basically done at this stage.
     
  41. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    This week we've had community member @Jesus join to help with the promo side of things. Additionally, he has been identifying usability issues that need tweaking, so I've been busy reworking some of the editor/inspector code.

    He has also discovered something Hydra does that we didn't even know Shuriken was missing: lighting in Hydra is properly calculated in worldspace:



    Finally, at Jesus' insistance, I have implemented bent normals:

    (video)
     
    Jesus likes this.
  42. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Vector fields!

    (video)
     
  43. Major

    Major

    Joined:
    Jul 26, 2012
    Posts:
    69
    Can the particles move independently of the movement of the source object? As in when a particle is emitted, and then the source moved, does the particle move with the source, or independently?
     
  44. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    By default particles are emitted in world space, but you can check a box to put everything into local space.
     
  45. feyyd

    feyyd

    Joined:
    Apr 23, 2014
    Posts:
    10
    Looking forward to this as well, if you need extra workers I'm looking for a project to work on.
     
  46. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Thanks for the offer Feyyd!

    I'm hoping we have things under control for now. I'll let you know if anything changes.
     
  47. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Hi everyone, I've been doing a bit of work with the Hydra team on workflow and demo stuff. Also known as pestering them for features as much as I dare without them getting too annoyed and sending me away!


    Hydra works well complimenting the shuriken system - the editor is very similar; you use the same sort of graphs and gradients so if you've used shuriken you can use Hydra. However, instead of brute-forcing with shuriken (fantastic at spawning thousands of simple particles) to get the most out of Hydra you should use forces a lot more - you have much more control over the particles, so you're trading quantity for quality.


    So, time to show some stuff. Just a bit for now, more later I promise!

    You can use gravity wells, as well as vector fields to move the particles around. This can be used for cloud systems and galaxies and stuff. You might also notice all the particles are long arrows - you can change the particle size in X Y Z so they're not square, and you can set rotation to match the direction they're travelling.

    Also note the squished sphere emitter - it responds to scaling and rotating like other a normal sphere so you can have discs of varying degrees of flatness.

    pic1.png


    This turbulent bokeh particle effect technically isn't unique to Hydra (it's mostly the shader doing the work), but it does show off something nice - particle colour options. Something new and very useful is a "Random in Gradient" option. Whereas in Shuriken you had to take a bit of a lottery if you used random between color or what not, now it's easy to chose colors and probability distribution.

    pic2.png
    Here I used a bit of red, mostly yellow/gold and some white. You can also adjust this by lifetime (commonly used for fading in and out), speed and camera proximity, and these are stacked and applied like Photoshop layers (different blend modes). This data is all sent in to the particle as Vertex Color so it works with normal shaders and can also be accessed in custom shaders.
    pic3.png

    And here's something FX guys the world over will like - correctly lit particle smoke!

    Because the particles now have normal and respond correctly to normal maps, in addition to both inward- and out-ward facing bent normals (very useful) you can now use particle systems more aggressively in well-lit scenes without fear of them looking out of place or poorly lit. Smoke, asteroids and debris has never looked better.

    pic4.png
     
    meteory.liu and VesuvianPrime like this.
  48. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    pic5.png

    Normal mapped specular cube particles respond to lighting as you'd expect.
     
    landon912 and VesuvianPrime like this.
  49. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    OK, time to bring this back from the bowels of the forum, the examples are almost all done, just need to do a bit of bugfixing and we'll be on the home stretch and I can start nagging away with feature requests yet again!

    Here's a quick look at how to use the forces available. Note that the arrows and glowy zones aren't actually part of the editor (just to make it clearer in the pics) but the shaders/materials for them will be available as part of the pack. Also, in these examples the particles are set to face their velocity direction (you can actually do that with Hydra, obviously)
    Directional Force.png
    This is a directional force. You can control the radius, falloff, intensity and direction. The particles are colored by lifetime using a gradient (fairly standard stuff). Fairly simple stuff.

    Damping.png
    This is a damping force. Similar controls (falloff, intensity, radius). The particles are colored by speed - note they start off fairly fast (red/orange) and as they are slowed by the Damping Zone they change to green, blue, and then purple before turning black when they are completely stopped.

    Gravity.png
    Gravity Force. Works pretty much like you'd expect. Uses the gravity values set in (Project Settings > Physics). Again the particles are colored by speed, notice how they accelerate downward before reaching peak velocity (red-to-white) just before hitting and bouncing off the ground.

    Gravity Well.png
    Gravity Well Force. This example is based off the old Newton's Cannonball theory - that if you can get the velocity right you can shoot yourself in the back. Achieving stable orbits with this can be done, or if you have areas that need to suck particles in, this is the force you need. Change intensity, falloff type, range to suit. Particles colored by lifetime (starting purple, finishing red)

    Turbulence.png
    Turbulence Force. Does what is says on the lid - a random turbulence that can make particles. Change falloff, intensity, range, and random noise phase and scaling.
     
    Last edited: Jan 27, 2015
  50. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    (continued)

    Target Force.png
    Target Force changes the direction the particles travel, but not the speed. Think of this as the easy version of the Gravity Well Force. Set the Target force to be low and you can easily get particles into stable orbits in no time. Also good if you need to aim your particles at something. As always, radius, falloff and intensity can be changed.

    Vector Field Advanced Example.png
    Gratuitous Vector Field example image...All your galaxy, maelstrom, vortex and cyclone needs have been taken care of. I hear our lead programmer is a big fan of storms.

    Bokeh Example.png
    Some optimization updates to the bokeh scene - using the particle geometry information in Hydra has allowed my to better cull the size of the particles when they're specks and out of focus leading to less overdraw and a higher framerate. This is actually a massive gain, and the shader is actually pretty simple (even works in Shader Forge!). The effect now takes a texture as well, so you can have your fancy hexagonal lenses or whatever you want, and it'll be blurred in-shader!

    Now, if you've got this far, congrats. We'll probably need a bit of help bugtesting sometime soon. There are still some small bugs to hopefully find, most likely buzzing around web player builds. Flapping away toward the cloud. I set up a scene that should bring them out, and you won't have to be David Attenborough to find them. It's just about shader/hardware compatibility and fallbacks for one of the more fancy effects (these bugs are safe). We'll probably need a range of AMD/NVidia, Windows/Mac, your fav browser, etc.
     
    VesuvianPrime likes this.