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

Shuriken, the new particle system

Discussion in 'Developer Preview Archive' started by Artimese, Dec 25, 2011.

?

How is the new system?

  1. Its great as it is, nothing needs to be changed.

    195 vote(s)
    56.0%
  2. Its too complicated to use, it must be simplified!

    108 vote(s)
    31.0%
  3. Its too hard to learn, I will not use this new system.

    45 vote(s)
    12.9%
  1. chronosapien

    chronosapien

    Joined:
    Feb 1, 2011
    Posts:
    73
    I'm having trouble using color over lifetime. It seems like it only animates colors with materials using the particle shaders, or maybe more specifically, with shaders using Tint Color as the main color. Am I missing something?
     
  2. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Shuriken outputs the colors to vertex colors, so you need a shader that outputs vertex colors in some way.
     
  3. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    You can still use the old system if you want to make something quick and simple.
     
  4. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    Thanks for reply.

    I'm trying to make particles that have infinite life and that do not move. While setting speed to zero does indeed make the particles motionless, the particles still die and re-spawn. How can I make it so that they stay there forever ?

    I use this for fixed objets like clouds in the background. With the old particle system, I would remove the particle animator component and only use the ellipsoid particle emitter with the particle renderer to achieve this. When starting the game it would display the clouds and they would stay on screen indefinitely.

    Also I have a question. I can't figure out what Distance does in the Emission module ? Its not really clear in the documentation. If you could explain what the Distance option does, it would be appreciated.

    Thanks !
     
    Last edited: Jan 4, 2012
  5. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Pause the system. You can just call particleSystem.Pause(); in LateUpdate(); (using a script)
    So you have a burst at time 0 and then you just hit Pause(). This can also be achieved by calling Prewarm(0.1f); (prewarm will playback particles for a certain amount of time and then pause the system)

    Distance basically emits particles (evenly) over distance instead of over time. So when your particle system moves it emits particles. It also works for sub emitters. It's really awesome for rocket smoke etc. Or if you just want to paint something in 3D inside Unity :)
     
  6. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    Thanks William,

    works great !
     
  7. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Having played around with Shuriken, the main thing I am not liking is that unlike everything else I have encountered in Unity, you cannot enter exact numbers for the curves, you just have to drag and maybe get near. This is particularly a problem where I have free and paid versions of an iOS app. If I make a change in one, I like to be able to write down the numbers and enter them in the other. It also relates to the way I think.

    The other thing is many options have the simple 1 number option called Constant, but if you want a bit more you have to go to a Curve option which is overkill in many cases, and leaves no numbers in the Inspector that are easy to read. It would be nice if there was an additional intermediate option for Max/Min. It might have the same complexity underneath, but has simple numbers for the user.

    p.s. I have reported 2 bugs in the Shuriken system (436588 436590), one relating to a problem I am getting when using certain combinations, the other to an input problem.
     
  8. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    You can get some value snapping by holding control when manipulating the curves and keys, but I agree and would love numeric fields like the Animation curve editor has.
     
  9. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Numeric fields for the positions of the points on the Gradient Editor also please.

    Is there a limit on the number of points on the Gradient Editor? I got a message come up about a limit of 8, but that has not reappeared despite going over that number, which is very easy to do as alpha is separate to colour.
     
  10. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    The limit is 8 color keys + 8 alpha keys.
     
  11. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Thank you. The message came up despite being under that number. I have not been able to reproduce it, so no bug report.
     
  12. MPN

    MPN

    Joined:
    Jan 5, 2012
    Posts:
    11
    Done. We have added a input field for key positions.
     
  13. Anxox

    Anxox

    Joined:
    Oct 29, 2011
    Posts:
    30
    Not sure if this was posted yet, this Thread has become quite long and I did not read all 111 reply's but when you tell the particle system to use Mesh instead of Billboard, it works well and looks great in the Editor but does not show up in flash.

    I love the collision stuff but it would be great if there where a bit more abilities under the collisions. Right now I can not tell them to stop spinning after they collide, or die and spawn a new particle in its place. That would be sweet!

    Keep going and you will turn this thing into toobox2!

    I really like the new system. Good Job.
     
  14. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Please submit a bug report on this.

    You can have particles spawned on both collision and death (using sub emitters). Also, you can make particles die on collision (set energy loss on collision to 1.0 - and yes, we are renaming this to lifetime for the next version).
     
  15. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    about shuriken:
    Is there [x] autodestruct somewhere? (as in the old version there was..or should use timer, Destroy (gameObject, 5); )

    How to delete particle systems? (in the editor, particle effect window, right clicking over it only shows "Create new particle system | Reset")

    (tried browsing the help files, but didnt notice about those..)
     
  16. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    This is not available in Shuriken. Instead we have exposed bool ParticleSystem.IsAlive(); which you can use to check if the particle system is alive and kill it yourself from script.

    This also allows you to reuse particle systems which is generally better than just creating and deleting them randomly.
     
  17. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    ^ ok thanks

    Sometimes I get this error
    and its difficult to find where its coming from..since it doesnt say any info.

    (time >= 0.0f) (time <= 1.0f)
    (Assert in file...Gradient.h at line: 108)
     
  18. MPN

    MPN

    Joined:
    Jan 5, 2012
    Posts:
    11
    In the next beta we added a 'Show Location' that will ping the particle system in the Hierarchy. Here you can delete it (or rename it).
     
  19. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    Sorry if this has been discussed already, but I was wondering if it will be possible to batch drawcalls between particle systems at some point ? For example, I have two particle systems, one being the parent and the other its child. They are both emitting a mesh that is using the same material. I think it would be nice if they could batch (similar to dynamic batching) or are there limitations that would prevent the batching from working between particle systems ?
     
  20. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Shuriken does this for sub emitters if you remove the renderer on the sub emitter and enable sorting. It's there to solve inter-particle system sort issues though and not for draw call performance gain.

    Shuriken also does batching of mesh particles (filling up as many that can possibly fit in a draw call).

    Is there a use case where this would give you a lot of performance you reckon?
     
  21. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    I got this as well today and fixed it. It was because I used random between 0 and 5 on the start energy, but if you get it under some other condition please let me know.
     
  22. voidward

    voidward

    Joined:
    Jan 3, 2012
    Posts:
    8
    I'm just messing around with shuriken right now but I'm not seeing how one would do the type of animations that rotation axis settings provided in the legacy particle system. The rotation settings are currently per-particle rather than affecting the entire particle system.

    Is there no way to do things like vortexes right now or am I just missing the relevant settings?
     
  23. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    In my project I have an object that can explode in 6 different pieces. When the explosion begins, I have 6 particle systems each emitting only one particle of a different mesh as a burst (the meshes are using the same material). This totals 6 Drawcalls. If I do the explosion with a simple animation instead of particles, the pieces get batched dynamically but I'm losing the control and randomness I can create with the particles. Also, I did not want to use physics and rigidbodies on each piece as it would be even worse, performance wise on mobile. That is why I wanted to use mesh particles to fake the explosion effect.

    So I can have the drawcall batch while using the animation but not while using the particles to create my explosion. That is why I asked about the batching of different particles systems, because I was trying to achieve the same drawcall optimization using particles instead of an animation. Also, my explosion lasts two seconds anyway so its not that big of a deal.

    I'm only emitting one particle per system in my case, so batching would probably be beneficial but how much of a gain that would be, I can't really say.

    A similar question was answered on page 2 of the thread; first post on that page. Be sure to also check out the dustdevil scene in the shuriken example project. That might help.
     
    Last edited: Jan 7, 2012
  24. voidward

    voidward

    Joined:
    Jan 3, 2012
    Posts:
    8
    Yeah I saw the example, requires basically 2 matching jigsaw splines which looks extremely awkward and is requires a good deal of precision to make it look accurate to what you're trying to create. Used to be just turning up 1 value.

    If there's not going to be an easier way, WBDN can you guys at least include one of those standard spline buttons that's a jigsaw pattern?
     
  25. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    Yes that fixed it.

    (Same error if use curve with values less than 0.028)
     
  26. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    We wanted to make a "repeat" behavior for the curves which would make this sort of thing easier. Unfortunately we didn't have time to finish it for 3.5, so more on that later.

    I imagine you could make the same using a rotating transform and local space simulation.
     
  27. bibbinator

    bibbinator

    Joined:
    Nov 20, 2009
    Posts:
    507
    Hi,
    The new particle system doesn't seem to work with LODGroup: All particle systems fire when run and there's no switching happening. Is this a bug or intentional?

    I think it makes a lot of sense that it should be supported. You can easily imagine that you would want a simplified particle system being rendered in the distance and be able to switch to more detailed ones as you get closer.

    Cheers,
    Brett
     
  28. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Why can't we select a Game Object as a particle type, only meshes? Makes it useless with RageSpline, forced us to roll out our own system (prolly less optimized than shuriken would be) to simulate particles with vector graphics.
     
  29. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    The particle array is exposed, so you could update your game objects using their positions.

    Look for GetParticles() / SetParticles()
     
  30. FiveFingers

    FiveFingers

    Joined:
    Oct 15, 2009
    Posts:
    541
    Please, correct me if I am wrong.
    what surprised me about the new Psys is that we tried for 2 emitters with same material got me 2 drawcalls!

    is this true? is the Stats overlay on game window broken? I would like to understand.
    Understand if to wait for 3.5 or to Buy new extras, like the quad mesh psys that will really make a single drawcall.

    in 2001 I made a Custom Psys in direct3d7 that was doing the batching using quad mes instead of sprites. This brought the speed of my app to light where I had an emitter for each shooting object (more than 200) all done with a single surface drawing call.(read 1 draw call).

    Te new Psys seem a lot better than previous (better emitter size, better management of respawn, and so I voted: no is good like this, but really, for game dev, is useless if each particle emitter with same material make a new drawcall. why is that???

    of course, the same goes for the GUI system, if a new is coming, making it again with no texture atlasing, will be useless !!!
     
    Last edited: Jan 9, 2012
  31. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Shuriken can generate extra draw calls in some circumstances:
    1. If there are too many particles to fit in a draw call. For sprite particles you need a LOT of particles for this to happen - more than 16000 particles on most platforms. For meshes it also does batching but splits up into multiple draw calls when it hits the hardware limits (example: you can fit at least 2500 Unity builtin boxes in 1 draw call).
    2. If you have multiple cameras or casting shadows (you can disable shadow casting in the particle system renderer) with your particles. In that case it has to draw the particles multiple times.

    Please submit a bug if your particle system generates extra draw calls that can't be explained by the above.

    2 separate particle systems with the same material does not do batching at this point.
     
    Last edited: Jan 9, 2012
  32. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    Do you know if this functionally will be introduced down the road ? From what Litobyte says, it seems it increased the speed of his app by a lot. If that is the case, it looks like it would be useful to batch them in situations where you are emitting very few particles per system.
     
  33. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Maybe. Let me think about it.

    EDIT: Okay, I'll take a look in the near future but it will not be for 3.5.
     
    Last edited: Jan 9, 2012
  34. Django

    Django

    Joined:
    Nov 25, 2008
    Posts:
    120
    Sounds great ! Thank you !
     
  35. clockwork_fromage

    clockwork_fromage

    Joined:
    Aug 2, 2011
    Posts:
    13
    can you tell us what kind of collision information will be available in 3.5 ?
     
  36. bibbinator

    bibbinator

    Joined:
    Nov 20, 2009
    Posts:
    507
    BUMP on my question on LODGroup above. Is this not supported for Shuriken particles or is it a bug?
     
  37. MPN

    MPN

    Joined:
    Jan 5, 2012
    Posts:
    11
    This should work, I just tested it with two particle systems. Basically the renderer is turned off/on by the LODGroup.

    Submit a bug with a test project and we will look into your use case.
     
  38. Razieln64

    Razieln64

    Joined:
    May 3, 2008
    Posts:
    129
    I cannot programmatically start the new ParticleSystem component. I can't event link it in a script in the inspector. The code sense in MonoDevelop doesn't show the Play function, only StartEmitting and StopEmitting.

    Do I have to use a different namespace in order to get the thing to work?

    Edit: I've just tried with a JS script and it works fine. The problem seems to come from C# script compilation. This looks like a bug.
     
    Last edited: Jan 11, 2012
  39. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    Visual Studio's intellisense works fine. There are Play and Stop, and there are no StartEmitting and StopEmitting methods.
     
  40. MPN

    MPN

    Joined:
    Jan 5, 2012
    Posts:
    11
    Submit a bug report
     
  41. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    Are you certain? I have started and stopped ParticleSystem components in script using c# without issue.
     
  42. Razieln64

    Razieln64

    Joined:
    May 3, 2008
    Posts:
    129
    This is not the case with mono develop on Mac OS X.

    Funny thing, it works fine when I create a new project, but not in my current project which uses the legacy system too.

    Edit: I just realized that I had a ParticleSystem class in my project before I upgraded to 3.5. There was a conflict. I'm terribly sorry. :(
     
    Last edited: Jan 11, 2012
  43. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    The Monodevelop in 3.5 beta is quite buggy with its autocomplete. If you add a new script, I've found you generally have to shut it down and do a "sync monodevelop project" in Unity to get it working again.
     
    Last edited: Jan 11, 2012
  44. Evan-Greenwood

    Evan-Greenwood

    Joined:
    Aug 6, 2008
    Posts:
    98
    I'm liking the Shuriken particle system... way way way more powerful than the old system and pretty much as easy to use.

    I haven't needed to Undo anything yet... if that isn't working properly it is going to bug me... I guess right now there is a generally unfinishedness about 3.5... I'm probably going to have to downgrade because of all the new bugs.
     
  45. parogames

    parogames

    Joined:
    Apr 12, 2011
    Posts:
    30
    Does the new particle system support auto destruct?
     
  46. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
  47. drfroz

    drfroz

    Joined:
    Jan 13, 2012
    Posts:
    3
    I don't know if anyone has noticed this yet, but I just solved a freeze bug on Android with Shuriken that was torturing me for days.

    In my game, when I instantiated a prefab that had a particle effect and some code to move the gameObject and whatnot, it froze my game randomly. After debugging, I found out that I had "Play on Awake" checked on the ParticleEmitter, so it was starting to play the particle effect although there was no guarantee that the rest of the prefab was loaded. So I unticked the "Play on Awake" button and started the particle emitter in my attached script's void Start(). This solved the freezing of the game. I couldn't reproduce this bug in the editor or on Mac platform, and there was never any error or warning given in the editor and my android device's logcat was useless.
     
  48. XeviaN360

    XeviaN360

    Joined:
    Jun 3, 2010
    Posts:
    181
    1) Is there a way scale an entire particle system (not the emitters but all the system)? Scaling via parent transform would be cool.
    2) Shuriken crashes randomly when emitting meshes (will submit crash to unity team)
    3) By the way, it's great :)
     
  49. WBDN

    WBDN

    Joined:
    Dec 23, 2011
    Posts:
    109
    Hey,
    Can you submit a bug with clear repro steps so we can fix it?
     
  50. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    Not sure where to ask, so I'll ask here!

    - Max particle size is about 2.5 or so. Is there any reason for this limitation? Can it be bypassed somehow?
    - Is there any way to duplicate a sub particle system? Doing so in the scene hierachy does weird things, like both emitters emitting the same particles.
    - For some reason, saving the scene causes the emitter shapes to dissapear from the scene view until the particle system is unselected and re-selected.
    - Start delay is ignored if prewarm is checked, even if looping is unchecked. I fought with that for a while...
    - Is there any way to scale the entire particle system?
    - The particle system crashes in the editor. A lot.

    And before I forget, despite the problems, the new system is a huuuge improvement. :)