Search Unity

Particle Playground

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

  1. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi save.
    I'd like to request the batch process function of the publish.
    I have to publish much particle prefab.
    It's possible?:)
     
  2. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hi Eric!
    You can add a little script for the particle systems you wish to start/stop emission after specified time, for example:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ParticlePlayground;
    4.  
    5. /// <summary>
    6. /// Assign this script to your Particle Playground system.
    7. /// </summary>
    8. public class TimedEmit : MonoBehaviour
    9. {
    10.     public float waitStart = 1f;
    11.     public float waitStop = 2.5f;
    12.     PlaygroundParticlesC particles;
    13.  
    14.     IEnumerator Start ()
    15.     {
    16.         particles = GetComponent<PlaygroundParticlesC>();
    17.  
    18.         // Wait for start
    19.         if (waitStart>0)
    20.         {
    21.             particles.emit = false;
    22.             yield return new WaitForSeconds(waitStart);
    23.             particles.emit = true;
    24.         }
    25.  
    26.         // Wait for stop (real time will be waitStart+waitStop)
    27.         if (waitStop>0)
    28.         {
    29.             yield return new WaitForSeconds(waitStop);
    30.             particles.emit = false;
    31.         }
    32.     }
    33. }
    34.  
    Hey! I know it isn't ideal and cumbersome especially now when there's focus on extensions, this will be updated in next version!
     
  3. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    (*** SOLVED *** see reply further below for solution)

    Hello,

    I recently purchased this asset; and when I import it in to Unity 5 Pro it gives dozens of compile errors such as:

    if I go change the lines that say something like:

    Code (CSharp):
    1.  public Gradient gradient = new Gradient();
    2.  
    To add UnityEngine. in front of the Gradients like so:

    Code (CSharp):
    1.  public UnityEngine.Gradient gradient = new UnityEngine.Gradient();
    2.  
    The errors go away - but it doesn't seem like I should have be doing this myself?

    Are you working on a fix for this? Or is there some namespace problem?

    Thanks for any help.
     
    Last edited: Apr 5, 2015
  4. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @melkior, It sounds to me like something in your system. Try importing into an empty project.

    I don't get errors with the current version of Playground in a U5 project with a lot of other assets.
     
  5. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    @hopeful you are correct a new blank project does work. I'm a little dumbfounded at that - my code doesn't do anything with particle systems, or gradients etc. I do have a few different assets (Natural Bloom,Dialogue System, Master Audio) but I don't immediately see a connection.

    Do you have any suggestions on how I would approach troubleshooting the conflict? I'm at a loss - it might be less effort for me to go add the UnityEngine. to them otherwise because I don't even know what kind of thing could cause this?

    Thanks!
     
  6. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Well, one thing that can get used up in a project are shader keywords. I'm really not familiar with the ins and outs of that, but maybe you've used up your available keywords and that's the source of the error?
     
  7. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    Unfortunately no - I'm pretty new to Unity so I'm not doing anything advanced at all - something like a shader would be advanced for me right now.

    I made a new project - and then imported all the assets I'm using first; and then brought Particle Playground in and it worked fine -- hoping that one of those would be the problem.

    The next thing I did was try to see if there was some way to clear a 'cache' or something in Unity for my project; as I've had this project since around Unity 4.3 and I upgraded it through the Unity 5 beta .. its possible something in my project got jacked up in Beta ; but .. like how to clear things out without ruining my project is beyond me too.

    I guess the next thing I could do is remove all of my code and see if the problem goes away.. I wish there was something that pointed directly at what the actual problem is. The error, and the fix I'm using seem like it *shouldnt* be a problem!

    Very frustrating - but thanks for the attempt at an answer.
     
  8. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    Okay problem solved.

    I had to get a search tool and search my project for "Gradient" , eventually I found a script that I had gotten during the Unity 4.6 Beta in one of the sticky threads that let you apply a Gradient to a Text/Font object and the script was called... Gradient!

    Thanks for the help.
     
    hopeful likes this.
  9. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Great you got it sorted! What should have been more clear in your case is if Unity would have thrown the "Ambiguous reference" exception. Unity can break a tad when naming classes the same as within the UnityEngine namespace.
     
  10. teddevos

    teddevos

    Joined:
    Apr 8, 2015
    Posts:
    3
    Hi,

    When I set simulation space to local on my spline particle it multiplies the particle spawn position by 2. How do I fix this issue?

    gif:
    http://i.imgur.com/vbKXPcr.gif

    Thanks !
     
  11. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey! When using splines with local space you can keep the particle system at Vector3(0,0,0) then move the spline(s) instead. This workaround is because a conversion would take up a bit too much CPU when simulating thousands of particles.
     
  12. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    More fiddling: if I turn off every Rebirth option (even ones like Random Velocity) it seems like Burst particles will emit most of the time (not 100% though) on subsequent Enable/Disable of the gameobject. What are the intended settings to make sure a Burst no loop particle system emits once on every Enable / Disable of the gameobject?
     
    Last edited: Apr 9, 2015
  13. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey Fuzzy, sorry about that!
    - Try updating to the very latest 2.26.
    - Try instead to use Lifetime Sorting: Linear or Scrambled Linear with Lifetime Emission set to 0.
    - Make sure Lifetime Offset is set to 0.
    - Make sure Prewarm isn't enabled.

    If none is working could you send the particle system over in a prefab to support@polyfied.com? There's most likely a setting intervening when giving the initial time for the particles.
     
  14. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Time to update to version 2.26! Introducing sticky particles, a collision cache, axis constraints for Manipulators, random Delta Movement, multiple preset export and some well needed fixes. You can read more about what's new over here.

     
    Last edited: Apr 9, 2015
  15. ShinKazuo

    ShinKazuo

    Joined:
    Oct 28, 2014
    Posts:
    12
    It worked, thank you!

    I have another question though haha. When I chance the particle count in a script, instead of just adding more particles it seems like it restarts the particle system again so the previous ones get deleted. Is there a way to just seamlessly change particle count?

     
  16. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Great! That's one of the difficult limitations to Playground due to all the caches and lifetime sorting structure. What you can do though is make use of the Particle Mask to visually change particle count over time. This is covered in the FAQ ("I'm changing Particle Count over time, why is my particle system restarting?") with a little script to help you get started:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ParticlePlayground;
    4.  
    5. public class ParticleMask : MonoBehaviour {
    6.  
    7.     public float mask = 0f; // 1.0f means full masking
    8.     public PlaygroundParticlesC particles;
    9.  
    10.     void Start () {
    11.         if (particles == null)
    12.             particles = GetComponent<PlaygroundParticlesC>();
    13.         particles.applyParticleMask = true;
    14.         UpdateMask();
    15.     }
    16.  
    17.     void Update () {
    18.         UpdateMask();
    19.     }
    20.  
    21.     void UpdateMask () {
    22.         mask = Mathf.Clamp01(mask);
    23.         particles.particleMask = Mathf.RoundToInt(particles.particleCount*mask);
    24.     }
    25. }
     
  17. ShinKazuo

    ShinKazuo

    Joined:
    Oct 28, 2014
    Posts:
    12
    I apologize, I should have checked the FAQ beforehand... I'll try it out! Thanks! :)
     
  18. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    That's alright, the section is rather new. :) Let me know if you need any more guidance on your way.
     
  19. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
  20. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Multiple preset export function is very nice!
    Thanks save!:)
     
  21. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi save.
    Texture sheet animation is working properly?
    I tried 4x4 16 frame texture sheet file.(tested unity4.5 PP 2.26)
    Single Row-random row not working...play only top row.
    Whole sheet random between two constraints not working.
    Only play first flame...
    I should use unity5?
     
  22. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hi! This is entirely connected to the Shuriken component (PP just present a serialized version of it). Enable the visibility of the Shuriken component through Playground Manager > Advanced > Show Shuriken to see if you get the same result when editing the atlas animation on the Shuriken.
     
    Last edited: Apr 17, 2015
  23. Etfaks

    Etfaks

    Joined:
    Jan 3, 2013
    Posts:
    4
    Hi Save.

    I've spent some time on trying to replicate the effect that is presented and discussed in this GDC video (at around 24:50 especially, but the whole video is great).
    http://gdcvault.com/play/1017660/Technical-Artist-Bootcamp-The-VFX
    It's basically a method mostly relying on shaders to blend multiple offset scrolling images per particle, which isnt a too big of a problem. The main thing I'm having trouble with is also having a random initial offset for each individual particle of the same system so that they arent clones of eachother and scroll through the UVs identically (which leads to patterns which is what I want to avoid). Is this at all possible in Unity or PP? I noticed that you in the beginning of this thread had thoughts about scrambling UVs etc. So I'm hoping you could point me in the right direction.
     
    chelnok likes this.
  24. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    Wow, this seems like a great idea. Do you have any idea what that technique is called? Does it have a name?

    I've tried googling everything I can imagine but still can't find any further details about this.
     
  25. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hey!
    I really like this approach as well, the effects possible with such shader is just remarkable given that there's such a low performance cost.
    There's no functionality to offset/scramble the Shuriken particle UV from within Playground but the actual lifetime sorting. The UV offset is entirely controlled by Shuriken and set by a particle's lifetime and there's unfortunately no good way around that but to run your own billboards.
    The only thing making UV offset possible is within the Rendering > Texture Sheet Animation > Animation Method, where you can set Random Between Two Curves or Constants. My best answer is that there's probably an approach through the UV animation you could try.
    Please share your findings! :)
     
    chelnok likes this.
  26. Etfaks

    Etfaks

    Joined:
    Jan 3, 2013
    Posts:
    4
    Scrolling UVs or animated textures maybe, it seem fairly rare to use the same terminology for anything games related. The combination of textures is called blendAdd by blizzard but others might know it as premulitply blend or something, at this point I am a little confused.

    I fiddled a bit more with it today, but I can't really wrap my head around shaders enough to actually get randomized UV offset for each particle. I tried using world position etc to apply some noise in the offset, but it just seemed to generate wonky results for me.

    It's far from perfect but here's my result so far http://imgur.com/6PnteBP
    I'm hiding the repeatings in a combination of having 2 particle systems with an instance of the material each and using the various settings in shuriken (scale, color over lifetime etc). In total 6 particles and 2 drawcalls.
     
  27. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    This is looking to be really promising! I'm sure more out there are interested in this approach, Playground or not. :)
    I don't dare to give much guidance when it comes to shaders as I'm kind of terrible at them, but perhaps you can get some feedback by asking here on the forums.
     
  28. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    I'm tried this method by UnrealEngine4.
    It looks nice (spawn rate is 10), I'm set random value to cascade(ue4 particle system) dynamic parameter.
    Random change value uv coordinate at particle spawn.
    But unity not have dynamic parameter...
    I'm referenced this thread.
    https://www.imbuefx.com/forum-wp/#/discussion/431/random-uv-offset-and-scale/p1
     
  29. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    @save

    It's been a while since I used PP and just downloaded the latest into U5.

    I really like the Explode/Implode and I want to use it, and I know this might be a stupid question, but how do I stop it from looping to just be a one-off play? (as I cannot seem to find out where to control this in the inspector?)

    EDIT - ok just found it - Emission/Emit/Loop !

    Also, is there just an Explode prefab (no implode) or do you have any recommendations here?

    BTW any ideas how much resource this might use on mobile and whether it could be suitable here?

    cheers

    Nalin
     
  30. brzyy

    brzyy

    Joined:
    Jul 2, 2014
    Posts:
    4
    Need a help please.
    Why Playground Particles C (Script) component disables everytime I run a game?
    Also stays disabled after stoping it.

    Screenshot_3.png
     
  31. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    We can probably use the "start color" setting to pass 4 random values to the particle shader, if we use "random between two colors" (0, 0, 0, 0 to 255, 255, 255, 255). The actual particle color must then be set in the material, but that's not much of a problem.

    I can't test this at the moment but it seems like it would work. :D
     
  32. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    It's very nice idea!
    How to the random value set in uv at particle spawn?
    I don't know a good way...
     
  33. brzyy

    brzyy

    Joined:
    Jul 2, 2014
    Posts:
    4
    I solved a problem.
    if you have a spline or other particle systems parented under main particle system and you remove them, Particle playground component disables in runtime.
    You have to remove all components via Playground UI and minus buttons and then its ok.
     
    Last edited: Apr 23, 2015
  34. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    If you let the shader animate the particle and you don't need to rely on UV offsetting for animation, you could approach it with using Animation Method: Random Between Two Constants and setting Frame Over Time: 0,1 (or 0, Tiles X*Y in Shuriken).
    The result is a random constant UV offset for each particle:


    This will however turn into repeating patterns over the count of particles, which could be a difficult limitation in certain situations. To solve that you can change the random seed for the specific rebirthing particle. In Playground that could be done like this:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ParticlePlayground;
    4.  
    5. public class ChangeSingleParticleTime : MonoBehaviour {
    6.  
    7.     PlaygroundParticlesC particles;
    8.     System.Random rand = new System.Random();
    9.  
    10.     void Start ()
    11.     {
    12.         particles = GetComponent<PlaygroundParticlesC>();
    13.  
    14.         PlaygroundEventC particleEvent = PlaygroundC.CreateEvent(particles);
    15.         particleEvent.broadcastType = EVENTBROADCASTC.EventListeners;
    16.         particleEvent.eventType = EVENTTYPEC.Birth;
    17.         particleEvent.particleEvent += OnParticlePlaygroundBirth;
    18.     }
    19.  
    20.     void OnParticlePlaygroundBirth (PlaygroundEventParticle particle)
    21.     {
    22.         particles.particleCache[particle.particleId].randomSeed = (uint)Mathf.RoundToInt(PlaygroundParticlesC.RandomRange (rand, 1f, 100f));
    23.     }
    24. }
    25.  
    The outcome is that every rebirthing particle will get a new random starting point in their UV offset:


    Interesting finding and thanks for sharing! I'll have a look to see if I can do something about that behavior in a future update.
     
    Last edited: Apr 27, 2015
  35. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    Nah this doesn't work as expected, it does a random gradient between the two colors. So this will let us pass only one random value to the shader. :(

    But this isn't offset, this is tiled. How would you modify these UVs in the shader to leave the scale at 1 uv across whole particle while having the random offset?
     
    Last edited: Apr 27, 2015
  36. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    This would possibly solve @Etfaks issue of initial offset:
    I'm not sure what happens in the shader after that and what's actually possible fragment-wise, but this enables a random starting point. If it is to any help I'm yet unsure of... :)
     
  37. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    It's nice!
    But I have some problem...I want to change only one UV coordinate.
    I made original shader by shaderforge.
     
  38. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102

    There doesn't seem to be a way to do that directly, the texture sheet animation (tiles the uvs) is the only thing we can use to modify uvs effectively.

    I've thought about the math for a bit and it seems fairly easy now:

    If we set the tiling to have 10 tiles in each axis, that means it'll give us a range between i.e. 0.1<uv<0.2 or 0.3<uv<0.4 as uvs. We want to turn this into 0.1 to 1.1 and 0.3 to 1.3 to get the original scale back. Let's try a formula like this:

    uv = uv * 10 + floor(uv * 10) / 10

    0.1 turns into 1.1, 0.1999 turns into ~2.1, just like we want! Note: there is probably a simpler way but I can't find one. Using this method each particle can show the full texture while having a random offset:



    ^ particles spawning over each other with random texture offsets
     
  39. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Hello, I'm a complete noob when it comes to particles and especially particle playground. I've got a huge particle subproject to do for our game. I need to create an atomic explosion as realistically as possible. It's a daunting task. Anyways, I've been working with PP2 trying to recreate different parts that I can merge together. It hasn't been going well. Nothing seems right. I'm not looking for details on how to create it, only some hints and ideas to help me get through this. There is lots of billowing smoke that I cannot seem to replicate and then the 2 caps with white hot particles that flow out and then back into itself. I've been using this picture for reference and of course a number of youtube videos showing atomic tests. Thank you for any ideas....

    http://7img.com/sub/m/m_atomic-explosion_AXEo8qQn.jpg

    Also, another related issue. I cannot seem to control the color very accurately. If I use a smoke texture with alpha and an additive shader, it's too white. If I use one with multiplicative, it's black. If I use the Alpha blend shader, there is no detail and looks like a cartoon. I'm confused on what I should be using that allows me to control the color and have detail.
     
  40. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Thanks comments Zeblote.

    My shader has 3 texture slot.
    I want to change only "Main" uv coordinate.
    Not change "Mask" and "Grade" uv coodinates.
    It's possible by particleplayground?
     
  41. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi save.
    I'm using texture sheet animation.
    My method is Random between two values, but it's strange result.
    please watch this.(Unity5.0.0 pro and pp version is 2.26)
     
  42. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    I'll have a look into it as soon as possible, there might be something faulty going on in the serialization conversion. In the meantime try using the Texture Sheet Animation on the Shuriken component directly to see if you get another result (Playground Manager > Advanced > Show Shuriken).
     
  43. Nimred

    Nimred

    Joined:
    Nov 1, 2014
    Posts:
    46
    Hello,

    I'm emitting particles by script with the attached piece of code. For some reason, when I try to give colors to the particles, it only shows if the color has a component at 0. Otherwise it's all white. For example RGBA(2, 256, 2, 256) would give me a white particle, but RGBA(0, 256, 2, 256) would give me... well, not green, but cyan. It's as if each component becomes either 0 or 1.

    The particle system itself is setup very simply, using Color Source = Source, Material = additive round material provided with PP2. If I modify it to emit its particles without my script, it works fine (but then it uses lifetime color).

    Am I doing this right? Is it a bug in particle playground? (My version is 2.25).

    Code (CSharp):
    1. public Color myTestColor;
    2.     public PlaygroundParticlesC myParticleSystem;
    3.  
    4.     void Start ()
    5.     {
    6.         StartCoroutine(EmitParticlesWhenReady());
    7.     }
    8.  
    9.     IEnumerator EmitParticlesWhenReady()
    10.     {
    11.         while(!myParticleSystem.IsReady())
    12.         {
    13.             yield return null;
    14.         }
    15.  
    16.         for (int i = 0; i < 4000; ++i)
    17.         {
    18.             // position retrieved from some other piece of code
    19.  
    20.             myParticleSystem.scriptedEmissionColor = myTestColor;
    21.             myParticleSystem.Emit(position, Vector3.zero, 1000000); //, myTestColor); // Tested that too, same result
    22.         }
    23.     }
     
  44. save

    save

    Joined:
    Nov 21, 2008
    Posts:
    744
    Hi there,
    Sorry about that and thanks for reporting it in! An unnecessary Color -> Color32 conversion which resulted in this somewhat rare error. Here's quick-fixes:
    v2.25
    v2.26
     
  45. Nimred

    Nimred

    Joined:
    Nov 1, 2014
    Posts:
    46
    It works now, thank you!
     
  46. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    I have two question:
    -is it possible to create a realistic electricity beam with PP using uv anim? any example or its out of its scope?

    - i used this to send damage to enemies with ParticleSystem
    Code (CSharp):
    1. public class ParticleSendMessage : MonoBehaviour {
    2.     public string methodeName;
    3.     public float parameter;
    4.     public string tag;
    5.  
    6.     void OnParticleCollision(GameObject other)
    7.     {
    8.         if(other.tag !=tag)
    9.            return;
    10.    
    11.         Debug.Log (other.name);
    12.         other.SendMessage (methodeName, parameter, SendMessageOptions.DontRequireReceiver);
    13.     }
    14. }
    How can i do that with PP?
     
    Last edited: May 16, 2015
  47. Infernomaster

    Infernomaster

    Joined:
    Jan 20, 2013
    Posts:
    16
    Hi I'm interested in buying your particle system.
    Something specific in what I am looking for is a way to create particles in the shape of a sprite on the fly.
    (e.g. I have some kind of blob and on a certain event I'd like to spawn particles around the edges of the triangle or in other cases spawn particles (fire) on the surface of the blob). I suppose it should be done with 2Dcolliders. is this possible?
     
  48. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    Hi, I read in the docs that this plugin doesn't work well on iOS64 bit, I'm currently using Unity 4.6.5 is it still the case with this version? Thanks
     
  49. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    I'll go ahead and answer my own question and say it does work on iOS64 on Unity 4.6.5
     
  50. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    I need to play a particle effect when the game is paused, ie: timescale = 0. How do I do this? In plain Shuriken I'd just use Simulate and pass in a manually calculated deltaTime. I need my particle system to work exactly the way it does in the editor when I'm not running the game.
     
    Last edited: May 21, 2015