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

Discussion in 'Assets and Asset Store' started by save, Dec 4, 2013.

  1. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    A getting started video is available. The goal is to cover most of the framework and show some tricks along the way in a couple of videos. Sorry about the poor narration at certain parts, first video guide ever, hope to get better at doing these. :)
     
    hopeful likes this.
  2. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    awesome , thanks save for the video, really helpfull. something come to my crazy mind ,was wondering if it is possible to pause a particle, i can t find a way to do that.

    cheers
     
  3. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Great! I'll lower the crazy resolution for the next, rookie mistake. :)
    Sorry not yet, but it is on the roadmap. It's a bit difficult with the current built-in array layout and how Lifetime Sorting + Lifetime/Rebirth works. I'll be looking into having a different structure to optimize the amount of required simulated particles in script mode and to open up for more flexibility to control single particle's lifetime - but don't expect it to be in the next update as it is a major rewrite of the system. However I believe the next update will be huge and really something!

    Perhaps there's another way around, having another particle system copying the position of the one you'd like to pause. If it is a random particle in certain world space you could use a Manipulator with Track Particles enabled to get all its current info (velocity, color, size, rotation etc.), then pass that over to your new particle system's playgroundCache.
     
  4. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Something I thought would be nearly impossible was just a few hours away thanks to SerializedObject. It's really amazing what you could do with it to reverse engineer Unity components. The best thing is that you can use it to both get and set properties (in Editor only). :)



    So in next update you won't have to enable the Shuriken component if you'd like to animate the UVs.
     
    twoc46 likes this.
  5. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    After some really confusing hours I've finally managed to pinpoint the issue. It was a movement and rotation delta missing which will additively move the particles equally as the transform of the current source. Then by separating the preparation of calculation and ParticleSystem.SetParticles() method into Update and LateUpdate the particles will follow the exact position of the created source positions. This will work in next update if you choose to sync the positions (Advanced > Sync Threaded Positions). Skinned mesh calculation will need to be set to Inside Particle Calculation in the threading aggregation (Playground Manager > Advanced > Skinned Mesh Thread Method) to not create any tearing, as it otherwise runs on another thread where we can't know when the vertex extraction is entirely ready.
     
  6. Taurris

    Taurris

    Joined:
    Aug 13, 2012
    Posts:
    14
    Hello,
    first of all, thx for the great plugin. I have a bit of a feedback on it though, after few days of working with it.
    I'll separate it into individual thoughts.

    1) I wanted to ask if it would be possible to add a feature to cache / save whole particle animation(simulation) not just individual snapshots ? I believe that it would(should?) be much faster, when realtime simulating is not necessary. It is quite heavy when using on mobile with higher amount of particles, on the other hand shuriken alone performs well.

    2) It would be really nice when using World transform or Skinned mesh as a source, that the particle colors would be sampled from the mesh+texture that is on the model. It's a bit awkward that I have to use State and supply it with mesh + texture by hand to achieve this.

    3) It would come really handy, to be able to set amount of particles when using Image as a State input. Right now, setting particles count less doesn't cover whole texture area, I think it would help if there would be an option to scatter the particles more randomly - right now it seems to be generated based on a sorted array of the pixels, it would help, if we could randomize the array of the pixel ID's. I'm not sure if I'm explaining this clearly, if not I'll try to give you an example later.

    4) Adding some limits box for particle positions would help. It's sometimes handy to be able to restrict particle simulation to a certain bounding volume, without actually having to constrain to a axis.

    Best regards,
    Vaclav
     
  7. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey Vaclav,
    Thanks for amazing feedback!

    1) There's currently no such plans, but it's an interesting subject to be able to record and playback an effect. I'll have a look into how this could be achieved and if it's reasonably applicable after the next update. The performance will differ greatly depending on the methods you use, how you're working with your source and what type of settings you apply. There should be some significant improvements of the calculation cycle routines in upcoming updates though.

    2) Sounds like a good addition, I'll look into it.

    3) Makes sense, I'll add a sorting method to States (similar to a Manipulator's Target Sorting when using a Skinned/World Object as target).

    4) You could use a Property Death Manipulator (they can inverse their bounding volume).
     
  8. Taurris

    Taurris

    Joined:
    Aug 13, 2012
    Posts:
    14
    Thx for the prompt reply !
    ad 4) I was more thinking about just restricting position of the particles, not "killing" or stopping them, but yes this could do the job as well. You can imagine it like a smoke in a glass ball - sort of
     
  9. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Oh I see, hmm interesting! Like a collision space, let me think a bit about that. We could probably use that technique for a couple of interesting things upon a manipulator with some settings to edit its behavior. Thanks!
     
  10. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Hey just a quick question now, what would be the best way to create and use a global manipulator in code?

    Thanks in advance :)
     
  11. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey! Quickest way is:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ParticlePlayground;
    4.  
    5. public class AddGlobalManipulator : MonoBehaviour {
    6.  
    7.     void Start () {
    8.  
    9.         // Add a manipulator to the Playground Manager (will be the transform the script is attached to)
    10.         ManipulatorObjectC manipulator = PlaygroundC.ManipulatorObject (transform);
    11.  
    12.         // Then set the type of the manipulator etc.
    13.         manipulator.type = MANIPULATORTYPEC.Repellent;
    14.     }
    15. }
    16.  
     
  12. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Amazing! thanks :D!
     
  13. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Hey again! I have something odd going on, whenever I emit a particle from code and this particle has an animated texture ( after enabling shuriken view and adding the material with the spritesheet) it seems that the particle will not animate, this is not the case when I use a source transform, any ideas how could I make it animate through script? thanks again!
     
  14. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey!
    That sure sounds odd, the source and lifetime isn't connected logically so there must be something else going on. I can't reproduce the issue either, scripted emission and animation seems to work as expected here. Could you send the particle system as a preset to me by email?
     
  15. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    To follow up, a reset of the particle cache's lifetime was missing when using scripted emission and was only noticeable when using texture sheet animation. If anyone else is experiencing the same issue you can add these lines anywhere inside the Rebirth function (starting on line 3928 in PlaygroundParticles.cs):
    Code (CSharp):
    1. playgroundParticles.particleCache[p].lifetime = playgroundParticles.lifetime;
    2. playgroundParticles.particleCache[p].startLifetime = playgroundParticles.lifetime;
    This regards version 2.14 and any versions prior to that.

    A lot of features and fixes is on its way! :)
     
  16. Gus3D

    Gus3D

    Joined:
    Dec 1, 2014
    Posts:
    27
    Wow, this is amazing! Can't believe I didn't find this sooner. Instabuy! I was wondering if you could point me in the right direction on how to achieve the Skinned Mesh Target or Mesh Target effect with Spine generated animations. Is it possible?
     
  17. thebroll

    thebroll

    Joined:
    Sep 26, 2014
    Posts:
    6
    Is there an ability to prewarm these particles?
     
  18. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks! As long as the final scene object has a Mesh Filter or a Skinned Mesh Renderer it should cope. One thing to look out for is that you can't have Optimize Game Objects enabled for skinned meshes as Playground wants to base calculation on the Transform bones.
    Next update you'll be able to target a State texture in the scene which might come in handy when you're working with sprites.

    Sorry not yet, I'm hoping to have this ready in next release. If it's a somewhat static effect you could try create a Snapshot and enable Load From Start.
     
  19. ZJP

    ZJP

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

    I have a challenge for you, for PP: Lift sand on the passage of a vehicle. :p

     
  20. DigitalGlass

    DigitalGlass

    Joined:
    May 12, 2009
    Posts:
    88
    Is there a callback for when the particlecount hits 0? I want to destroy the gameobject when that happens, without polling for particle count.
     
  21. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    That could be a velocity+/turbulence manipulator attached to the vehicle where manipulator's strength is connected to the speed of the car. :)

    Code (CSharp):
    1. using UnityEngine;
    2. using ParticlePlayground;
    3.  
    4. public class ChangeManipulatorStrength : MonoBehaviour {
    5.  
    6.     public float someStrengthValue = 1f;
    7.     public PlaygroundParticlesC particles;
    8.     ManipulatorObjectC manipulator;
    9.  
    10.     void Start () {
    11.         manipulator = PlaygroundC.GetManipulator(0, particles);
    12.     }
    13.  
    14.     void Update () {
    15.         manipulator.strength = someStrengthValue;
    16.     }
    17. }
    18.  
    Sorry there's no callback for that. Could you describe a bit more in detail what you'd like to achieve? Changing particle count will rebuild all arrays and therefore it's not ideal to alter particle count over time. I will look into a better structure for that, but till then the particle mask can do a good job in masking out particles from simulation (next version has sorting methods).

    For a non-looping system you can tick Disable On Done set to Destroy in Particle Settings (from v2.12 and up). You could also call if (particleSystem.IsAlive()) to check if any particles are still simulating.

    Nevertheless checking if particle count is 0 and destroying the GameObject could be done like this:
    Code (CSharp):
    1. using UnityEngine;
    2. using ParticlePlayground;
    3.  
    4. /// <summary>
    5. /// If particle count is 0 then destroy the GameObject. Attach this script to the particle system itself.
    6. /// </summary>
    7. public class CheckParticleCount : MonoBehaviour {
    8.  
    9.     PlaygroundParticlesC particles;
    10.  
    11.     void Start () {
    12.         particles = GetComponent<PlaygroundParticlesC>();
    13.     }
    14.    
    15.     void Update () {
    16.         if (particles.particleCount==0)
    17.             Destroy(particles.particleSystemGameObject);
    18.     }
    19. }
    20.  
     
  22. x3Frozen

    x3Frozen

    Joined:
    Oct 22, 2013
    Posts:
    3
    Hi guys, Can you explaine me how to creat the same effect on video(with purple trail)
     
  23. DigitalGlass

    DigitalGlass

    Joined:
    May 12, 2009
    Posts:
    88
    @save What I'm trying to do right now is turn off emit, but after all the particles are removed, I want to destroy the particle in the scene. Unfortunately, I'm not doing this in monobehaviours, so I don't have the option of polling the particleCount and checking if it's 0. I can create an extra script that is attached to the particle system that can destroy itself, but it'd be more ideal to register a callback or an event, in case I want to do some extra logic when the particle system is destroyed.

    Also, is there a way to fast forward the simulation? In shuriken, I can call the Simulate function in a for loop and tick towards the simulation time I want, but I'm not seeing anything similar in pp.
     
  24. mrwogs

    mrwogs

    Joined:
    Aug 20, 2014
    Posts:
    36
    Thanks for writing this amazing particle system! I purchased PP2 recently, but I am running into an issue which seems like it should be easy to resolve.

    How do I animate the Particle Settings?

    I have a simple setup with an emitter shooting out snowflakes. Early in my scene, I want to set a key frame with the Particle Count set to 0, and several seconds later, I want to set a key frame with the Particle Count set to 1000. Am I missing something obvious here?

    I tried playing with the Snapshot system, and was able to save two different versions of my emitter with the two different Particle Count values, but was not able to animate between the two snapshots.

    Thanks for your help and continued product support!
     
  25. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    I'm quite enjoying the playground so far. :)

    I've written my own time manager so that I can separately modify the time scale of different parts of the game. Is there any way I can easily change the time scale applied to individual particle systems? I'll happily customise code if required, I'm mostly wondering if there's a recommended place to make that change.

    Separately, I've got an issue with a manipulator when I play with the global time scale field in PlaygroundC. With non-zero values everything seems to behave as expected. However, if I reduce the global time scale value to 0, and then increase it back to 1 (or any non-zero value), any particles whose velocity comes from a manipulator don't start moving again. The manipulator is still working, as newly spawned particles accelerate as expected. What am I missing there?

    Edit: Still not sure what I was missing, but I re-implemented the feature with a velocity manipulator and it now works through time scale changes.
     
    Last edited: Dec 6, 2014
  26. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Can i take other shuriken particle systems from the asset store and load them up into particle playground and edit them?

    Can i manage all my shuriken particle systems which were not originally created using particle playground using this package?

    What does this multi-threading feature give me? Is it only for particle playground creations or is can it cope with other shuriken particle effects?
     
  27. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    How do i change the color of a particle in script ? I tried _particles.lifetimeColor.colorKeys[0].color = value; but it does not change the color value.
     
  28. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    That one took me a bit of fiddling to work out, too. You need to set the entire colorKeys array, not individual values. The setter doesn't appear to do anything, which I guess may be a bug in Unity? (I can understand not wanting to let us set individual elements, but then it shouldn't let us assign to it).
     
  29. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Thanks for this important info. I think the author of the product should have a help sheet with this type of gotcha info on it !
     
  30. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I believe that would be best achieved with a trail/line renderer. You might find this package interesting: https://www.assetstore.unity3d.com/en/#!/content/16076

    I understand, you could try turning off loop and emit at the same time, then it will trigger the Disable On Done's specified routine. If it's PlayMaker you're using you can drag the Inspector component Playground Particles C (Script) to the State section of PlayMaker to expose the variables and functions of the particle system.

    No sorry there's no such thing as fast-forwarding or pre-warming yet, I'm working on making that happen. The only resembling behavior available is using a Snapshot to set particles to a predetermined state.

    Thanks!
    Changing particle count over time is unfortunately something PP is bad at due to the current built-in array structure. Every time you do that the PlaygroundCache will be rebuilt and force the system to reboot. This is why the Particle Mask (found in Particle Settings) got introduced to resolve that issue, where you can mask and fade the amount of particles needed. Next version will have a Mask Sorting where you can choose between Linear, Reversed and Scrambled.

    Having two snapshots with different particle count should work though, where if you use a transition it should fade particles and put them into place upon loading the next snapshot. Was this not what you were seeing when trying it out?

    Great! :)
    I will be looking into having a separate time scale for each particle system, it won't be available in next version as the gist of making that happen in a more optimized way means rewriting big chunks of the framework. This is something which will come along with a different array structure for iterating over the particles, but I can't say exactly when. There's a big update coming, hopefully right after that.
    For manually controlling particle time as it is right now, here's a clever solution by Issam: http://forum.unity3d.com/threads/particle-playground.215154/page-10#post-1731163

    1) You need to recreate them from ground up as the systems are so far apart in their structure. Often this is a rather quick procedure though, feel free to ask for any details.

    2) Playground is a closed framework in the aspect that the techniques used for altering particles must be made with a PlaygroundParticlesC component.

    3) It's for calculating the different aspects of a PP system (skinned meshes vertex extraction, turbulence algorithms, manipulators and the particle calculation loop). You can make use of it yourself for anything in your project by calling:
    Code (CSharp):
    1. PlaygroundC.RunAsync (()=> {
    2.     // Your heavy calculations in here
    3. });
    Indeed you need to grab and edit a copy of the gradient's keys and then put them back, here's two examples of working with gradients: http://pastebin.com/fPr9XWdm
     
    Last edited: Dec 8, 2014
  31. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Has anyone done a particle playground to shuriken inspector value association. The reason for asking is that i would like to get all my shuriken particles working under this framework to take advantage of the multi-threading. Is that a wise and doable thing to do ?
     
  32. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Sounds like I need to get a FAQ in place. :)

    That is a cumbersome task I'm afraid as you would need to dig through the Shuriken component as a SerializedObject: http://forum.unity3d.com/threads/particle-playground.215154/page-12#post-1799738
    Then as the systems are far apart in their techniques used (for worse in this case), it will be difficult to determine a generalized way how the values apply from Shuriken into Playground.

    My suggestion is if you are looking to work with the particles with any of the Playground's features, try mimic the Shuriken particle system's settings in Playground (it could be a good way to learn about the settings in PP). If not, you won't gain anything from using the Shuriken particle system as it is in a PP system, but instead create an overhead of setting particles back into the Shuriken component and allocate more GC as each thread requires a couple of hundred bytes. So it would only make sense if you want to use stuff like PP's emission possibilities, apply turbulence, do any live manipulation to the particles or use any other PP specific features.
     
  33. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Hey! I hope all is good :), I have a request if possible, whenever doing an emission through code I am required to specify color, velocity and position, I would like to be able to just give the position and let the particle do what the settings are telling it to do. Would this be too difficult?

    let me know please, thanks!
     
  34. Ennothan

    Ennothan

    Joined:
    Oct 17, 2013
    Posts:
    51
    Hey there,
    There is a way to separate lifetime and duration?
    In shuriken, duration tells the time it will take to emit all the particles and lifetime how long each particle will stay alive.
    In PP I can only see lifetime, which if I increase, increases duration and lifetime of each particles together.

    One example effect for this could be something I want to keep emiting for 5 seconds and stops emiting, but each particle will not dies after 5 seconds of emission, I want it alive for 40 seconds.

    So, there is a hidden way to do it? if not could you add this feature?

    Thanks!
     
  35. s_guy

    s_guy

    Joined:
    Feb 27, 2013
    Posts:
    102
    Hi,

    Is there a way to change a system's loaded snapshot via Unity Animation?
     
    Last edited: Dec 8, 2014
  36. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Sweet, that's the kind of thing I was looking for. Thanks to you and to @Issam for sharing!

    While it's not an issue for me now, any ideas on why particles stopped moving with a gravitational attractor manipulator after the time scale had been set to 0 and then back to 1?
     
  37. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Hmmm... the thing is that Gradient is a Unity thing, not a Particle Playground thing. I don't necessarily thing it's a good idea to try and document 3rd party stuff. A better idea would be if Unity allowed comments to be posted on its own doc pages so that the community could post this kind of thing there for everyone to find.
     
  38. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Yes but its all about helping people use this product better!
     
  39. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey Jake, thanks all good! More emission options are coming in next version where this is tagging along. :)

    That's a good question, that behavior would be really useful out of the box. Currently you can use scripted emission and control the rate over 5 seconds where particle lifetime is set to 40. Here's an example which should emit your set particle count over the specified seconds:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ParticlePlayground;
    4.  
    5. /// <summary>
    6. /// Scripted emission during specified time.
    7. /// </summary>
    8. public class EmitDuringSpecifiedTime : MonoBehaviour {
    9.  
    10.     public float seconds = 5f;
    11.     public Vector3 position;
    12.     public Vector3 minVelocity = new Vector3(-1f,-1f,-1f);
    13.     public Vector3 maxVelocity = new Vector3(1f,1f,1f);
    14.     public Color32 color = Color.white;
    15.  
    16.     PlaygroundParticlesC particles;
    17.  
    18.     IEnumerator Start () {
    19.         particles = GetComponent<PlaygroundParticlesC>();
    20.         yield return null;
    21.         StartCoroutine (Emit());
    22.     }
    23.  
    24.     IEnumerator Emit () {
    25.         float emissionRate = 0;
    26.         int emitted = 0;
    27.         while (emitted<particles.particleCount) {
    28.             emissionRate += (particles.particleCount/seconds)*(Time.deltaTime);
    29.             int r = Mathf.RoundToInt(emissionRate);
    30.             if (r>0) {
    31.                 if (emitted+r>=particles.particleCount)
    32.                     r = (particles.particleCount-emitted);
    33.                 particles.Emit (
    34.                     r,
    35.                     position,
    36.                     minVelocity,
    37.                     maxVelocity,
    38.                     color
    39.                 );
    40.                 emitted += r;
    41.                 emissionRate = 0;
    42.             }
    43.             yield return null;
    44.         }
    45.     }
    46. }
    47.  
    I'll look into adding this as a feature though.

    Hi, yes you can add an animation event to call a function on a script which will load the snapshot. The int will be the snapshot's number in the list (could also use a string to call the snapshot by name).

    Code (CSharp):
    1. using UnityEngine;
    2. using ParticlePlayground;
    3.  
    4. /// <summary>
    5. /// Put this script on the object using the animation. Set the number of snapshot to load as an int in the animation event.
    6. /// For more information: http://unity3d.com/learn/tutorials/modules/beginner/animation/animation-curves-events
    7. /// </summary>
    8. public class LoadSnapshot : MonoBehaviour {
    9.  
    10.     public PlaygroundParticlesC particles; // Assign your particle system in Inspector
    11.  
    12.     public void Load (int index) {
    13.         particles.Load (index);
    14.     }
    15. }
    16.  


    See this tutorial: http://unity3d.com/learn/tutorials/modules/beginner/animation/animation-curves-events

    I'm not sure exactly, I've been testing it out with this but it behaves as expected:
    Code (CSharp):
    1. using UnityEngine;
    2. public class SetTime : MonoBehaviour {
    3.  
    4.     public float time = 1f;
    5.  
    6.     void Update () {
    7.         time = Mathf.Clamp (time, 0, 100);
    8.         Time.timeScale = time;
    9.     }
    10. }
    If you stumble upon it again and can reproduce it, try running the particle system in non-threaded mode (Advanced > Particle Thread Method: No Threads) to see if you get any exceptions.
     
    s_guy likes this.
  40. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Sure. I can pull the code I was using out of my VCS and send it over, too. Fingers crossed I remember to do that when next I work on my game...
     
  41. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I'm happy to receive anything helping the hunt for any anomalies. :)
     
  42. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    369
    Hi save,

    I have problem with OnBecomeInvisible of PlaygroundParticlesC.
    It's call for particle when systeme is visible. ( editor camera and game camera watch the sames things)
    I have another problem ( which may be related), PlaygroundParticlesC are rarely desactivate when they are outside of screen. It's big problem for mobile performance.

    If you need more precision, ask :)

    Edit : Playground reserve 3.1kb per frame too is big for 12 systemes visibles ( 60 systemes ingame)
     
  43. thebroll

    thebroll

    Joined:
    Sep 26, 2014
    Posts:
    6
    Hey Save,

    I am hitting a roadblock and cant seem to move forward. i have duplicated a prefab'd PP 6 times all seems good to go. Upon duplicating a 7th all other similar prefabs seem to not work anymore. is there a limit of the number of systems you can have in on scene at any given time?
     
  44. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hi!
    If you're not already, try using Advanced > Auto-Pause Calculation, that will trigger the particle system to halt its calculations when no camera is viewing its particles. Otherwise I could use some more precision. :)

    How are you measuring the reserved memory? In case that's GC allocation it depends a lot on what settings those systems use, you'll for instance have higher when working with skinned meshes or using a manipulator which is tracking particles, could that be the case? I can only see 120 bytes on 12 systems when not multithreading (to be able to fully profile), 1.2kb with multithreading enabled over 4 cores using the default "New Particle Playground System".

    Hi!
    That sounds really odd, there's no such limit. Could you possibly send those prefabs in a UnityPackage over to support@polyfied.com so I could have a look at what's going on?
     
  45. Ennothan

    Ennothan

    Joined:
    Oct 17, 2013
    Posts:
    51
    Thanks Save, you are the best!
     
  46. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    369

    There are all on Auto-Pause.
    I find this problem when I have had a break point on OnBecameInvisible, which was call for all particle system.
    So I have add a icon ( for more easy visual) in hierarchy windows for system which are calculate.
    ( condition for draw icon :
    Code (CSharp):
    1. ParticlePlayground.PlaygroundParticlesC pp;
    2.  
    3.        pp = go.GetComponent<ParticlePlayground.PlaygroundParticlesC>();
    4.  
    5.         if(pp != null && pp.calculate && pp.IsAlive())
    )

    And I obtains that :



    For watching that



    For memory, I obtiains this number from profiler. And for now I have 2 differents type of system :
    - Draw from a worldobject with fiew vertex number.
    - Draw from a worldobject ( a cube ) attirate by a manipulator

    But 3kb per frame is huge even for that. ( screen of profiler is take in the same time that pictures above)

     
  47. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Thanks for getting back with the details, pictures helps a lot! That's really clever using an icon that way, and a better overview for which objects are particle systems. I'll implement something similar into next version and test what's going on with the calculation culling.

    For the GC allocations, you don't happen to have 8 cores on your system? Try setting Playground Manager > Advanced > Max Threads: 4 (or you could try Particle Thread Method: One For All as you have so few particles in each system, depending on how that performs on your end-target). The amount of vertices in a mesh doesn't have any impact on the allocated GC as long as it isn't procedural (which judging from your pics isn't). Each of your particle system should allocate around 12 bytes, then each thread should allocate around 350 bytes per call. So this will differ based on what platform Playground is running when having the Particle Thread Method in Automatic mode with the standard settings.

    Hope it helps, otherwise get back to me and we'll look further into it! :)
     
    Last edited: Dec 12, 2014
  48. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    369
    cool :)

    I have set max thread to 8 and set one for all. So I start scene but I still have the problem. Worse, when I desactive all system except one I have still 3kb per frame ! changement is just for calulation time :(
     
  49. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    That's really odd, how many active threads and processors do you see in Playground Manager > Advanced > Multithreading (in Automatic and One For All mode)? If the particle systems are set to Advanced > Particle Thread Method: Inherit (in their individual settings) and having a multicore system you should absolutely see different GC allocations depending on your Particle Thread Method in the Playground Manager.

    One thing I notice though is that the automatic bundling of thread calls isn't checking if the GameObject is active, so it will still produce an empty bundled thread with those. That should be fixed in next update!

    I'm a bit at a loss what this could be, you're welcome to send your scene over to support@polyfied.com and I'll run some tests for you.
     
  50. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Here's an update of the upcoming spline feature which has been quite the handful getting into place. :)
    It's getting a bit difficult to generalize examples as there's just far too many options and scenarios applicable but I hope the general idea of working with splines come across.


    Playground Spline

    The Playground Spline is based on this amazing tutorial by Jasper Flick, then adapted to be able to work with the nodes and bezier handles more freely (adding/removing at certain handle, node sorting, time offset and reversing, Transform/Vector3 nodes and multithreading support). What I also wanted was a good overview of the available nodes in a list, where you can see which point you're currently working with and edit that more quickly (see the Inspector image below). You can structure your spline from Vector3 values, then export that to transforms (with or without bezier hierarchy structure) which makes you able to control your spline without much scripting going on.

    Here's what it currently looks like working with a spline in the Scene and Inspector:



    Splines and particles

    A particle system can handle structuring the birth positions from splines and target it through a manipulator (so you could emit from one spline and target another over time for instance). You can assign several splines onto one particle system and treat them as individual starting points to end points or you can treat them as a conjoint spline. All methods are available except Overflow Offset (as having more particles will create a more dense distribution) when working with splines, so you could for instance have particles build up from a spline then animate their individual movement with Lifetime Positioning. The Initial Local Velocity will calculate from the velocity at the time of the spline, which makes you able to move particles by force in the spline's curve direction. Should you want a more confined setup you can enable Only Source Positions and offset the spline time (globally from the PP system and locally on each individual spline). The spline is at all times live in the scene and can be updated on runtime where one spline can be read from multiple particle systems.

    The particle system Source Inspector:


    To illustrate the individual vs conjoint behavior, reading the splines as individual objects from one particle system looks like this:

    Where treating them as one spline behaves like this:

    (example is using a particle Lifetime Sorting of Linear)

    The behavior shown above alone should able you to make some highly controllable effects.

    Also introduced is the option of coloring the particles by array (instead of the regular lifetime), which makes you able to color a particle depending on their distribution along its source:

    (example using a heart-shaped spline as source and a circular spline as target)

    Perhaps the most interesting application takes place once you start to combine the PP features, here's a particle system using turbulence with a spline target:

    The spline target manipulator has options to target positions on the spline based on either the particle- or spline time and time offset. Other than that it has the same behavior as any other manipulator.

    The Playground Spline is not bound to particles only, you could use it for any other component reading time from the spline (moving GameObjects for instance). I'm really eager to release this to you! But we haven't entered beta yet, there's still some important features and fixes needed. Soon though! :)
     
    Last edited: Dec 12, 2014
    JakeTBear, red2blue and DigitalGlass like this.