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

PA Particle Field - Superfast, GPU Based, Persistent Particles

Discussion in 'Assets and Asset Store' started by popupAsylum, Apr 17, 2015.

  1. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Hi @popupAsylum,

    Just been looking at your reviews for this asset while on sale. I was wondering if anyone else has hit problems with 5.4.2f1 like the last reviewer?

    Thanks

    ps. Using your shark in my game and it looks fantastic:)
     
  2. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Hi @docsavage

    Yeah there seems to be an issue in the latest version, I'm on it now, I'll setup a package once it's fixed and pass out the link via PM to anyone that needs it before it goes through the asset store approval process.

    Glad you like the Shark!
     
    mccann likes this.
  3. DreamElder

    DreamElder

    Joined:
    Oct 15, 2016
    Posts:
    1
    yea,just bought the package shortly ago.

    fyi, demos bokeh,caustics,comparison,rain,snow,stardust are not functioning, with no errors.

    tested on 5.3.4f1, and 5.4.2f1.

    would love link. i have no idea how long approval process takes,but if its just a few days then no biggie. nice to see your quickly on top of things. cheers :)
     
    mccann likes this.
  4. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020

    Thanks for the reply.

    Shark's great:)

    Maybe worth your while saying the fix is incoming on the store page so potential buyers not put off while the sale on. Just a thought.
     
    Last edited: Oct 15, 2016
  5. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    @DreamElder @docsavage

    It's almost entirely to do with soft particles, I changed how it worked in the latest version, previously it was done per vertex and the units were in clip space, now its done per particle and in worldspace units.

    Changing soft particles to anything other than "None" should make the particles show up and I'll have the package ready soon
     
    Xaron and docsavage like this.
  6. LynoHD

    LynoHD

    Joined:
    Dec 7, 2013
    Posts:
    7
    @popupAsylum I wasnt able to PM you for some reason but i have my invoice number ready if you could send me the package :)
     
  7. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Struggling to PM you too, could you drop me an email at info@popupasylum.co.uk?
     
  8. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,200
    @popupAsylum : I deleted my review. Since you say here it's just a bug (found this forum's link in another review), I trust this will work in the future. Also a quick reply means a lot in regards of support.

    Looking forward to try out the new version.

    Btw, I also can't pm you, all I get is: "You may not start a conversation with the following recipients: popupAsylum."
     
  9. MungeParty

    MungeParty

    Joined:
    Sep 13, 2012
    Posts:
    2
    Same problem here. I'm glad to know it's being worked on! I'd greatly appreciate a link as well, just purchased yesterday and couldn't find anything in the docs/asset page about this issue. Great value for the functionality, assuming it gets fixed. Thanks!
     
  10. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    264
    I stumbled upon two issues while using the Starfield prefab with an orthographic camera:

    1. The initial random positions of the particles aren't uniformly distributed as you can see on the following image:

    distribution.png

    I solved that on my own by changing the line:

    Code (CSharp):
    1. Vector3 randomPosition = new Vector3 (GetRandomAndIncrement (-1f, 1f), GetRandomAndIncrement (-1f, 1f), GetRandomAndIncrement (-1f, 1f));
    in the method UpdateDirection of PABillboardParticle.cs to:

    Code (CSharp):
    1. Vector3 randomPosition = new Vector3 (Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
    and enabling the CheckBox "Rebuild At Runtime". The source of this problem seems to be the incrementation of the seed in GetRandomAndIncrement!

    2. Using the transparent shader in conjunction with the orthographic camera makes the particles disappear like so:

    transparency.gif

    Any ideas on why that's happening?
     
  11. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    379
    Just bought it and have the same problem like the others here using 5.4.1
     
  12. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Thanks for that great report @BrightBit!

    There seems something odd with the first random value after setting the Random seed in 5.4 that has affected the GetRandomAndIncrement function, this can be fixed by adding a new random call after line 287 in PAParticleMeshGenerator.cs in SetState, the function should then look like this;

    Code (CSharp):
    1. public static void SetState(int seed)
    2. {
    3. #if UNITY_5_4_OR_NEWER          
    4.     Random.InitState(seed);
    5.     Random.Range(0f, 0f);
    6. #else
    7.     Random.seed = seed;
    8. #endif
    9. }
    For the particles not appearing in orthographic, it's to do with a work around I put in when using OpenGL (including emulated), if you change line 1415 in PAParticleField.cs to;

    Code (CSharp):
    1. if (isOpenGL) {
    2.     renderingMaterial.SetFloat(PAPFHelper._NearFadeDistance, Camera.current.orthographic ? 0 : mNearFadeDistance);
    3. }
    That should fix it, these changes will get into 1.32 which will probably make the asset store skip 1.31
     
  13. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    264
    That worked indeed! However, I'm using Unity 5.3.5f1, so I had to write:

    Code (CSharp):
    1. public static void SetState(int seed)
    2. {
    3. #if UNITY_5_4_OR_NEWER        
    4.     Random.InitState(seed);
    5.     Random.Range(0f, 0f);
    6. #else
    7.     Random.seed = seed;
    8.     Random.Range(0f, 0f);
    9. #endif
    10. }
    Your solution to your workaround worked, too. Thank you. :)
     
    popupAsylum likes this.
  14. mccann

    mccann

    Joined:
    Sep 24, 2013
    Posts:
    30
    Looking forward to the fix! I can wait until it is updated on the Asset store (but hoping that process doesn't take too long).
     
  15. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Hi there, can particles collide to each other? Can particles collide to any collider or trigger?
     
  16. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    @ikemen_blueD Not at the moment, maybe in some variety in the future with the more generic system support.

    The plan with the more generic system is it will pre-calculate collisions, store that data in the particle mesh and play them back in the shader on the GPU, this will work well for static colliders initially. Following that it will be getting the mesh generation multi-threaded and/or executing over multiple frames while the shader's playing back the previous data, once the new mesh is generated the shader can be updated and continue with the new data, this could then support most collisions and you could balance how much CPU it can use versus how often the mesh/simulation is updated.
     
    ikemen_blueD likes this.
  17. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @popupAsylum Just upgraded to 5.5, looks like its stopped working, any chance of an update?
     
  18. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    @punk Definitely, I'm looking at this today
     
    Rowlan and punk like this.
  19. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    @popupAsylum I have no explanation, but today I was working away and all of sudden my particles appeared again, it appears that your package is working perfectly fine for me now in 5.5, really sorry to mess you around, I have no idea what happened
     
    popupAsylum likes this.
  20. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    Hello, is there any way to change de color of the particles via script? I've tried to change PAParticleField.color but it doesn't change it.

    Thank you.
     
  21. davide445

    davide445

    Joined:
    Mar 25, 2015
    Posts:
    138
    Searching for gpu based particle systems your is one of the only three I found.
    Not sure if might be useful for my goal, I did want to achieve this kind of effects


    to be used for video creation. Interested to know if PAPF can interact with assets, can be emitted from mesh, particles does have a lifetime, there are turbulence.
     
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Out of curiosity, what are the other two?
     
  23. davide445

    davide445

    Joined:
    Mar 25, 2015
    Posts:
    138
    TC Particles and PopcornFX, not sure the first one it's still actively evolved, the second it's really powerful but currently for technical artists, need to have a more friendly interface with 2.0 version coming 2017Q1. Does have also some limitations due the lack of Unity API to integrate his custom particle system with Unity events and objects. No perfect solution available right now I fear ...
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I don't think PopcornFX is a GPU solution. It does some things differently for batching and threading, but not GPU based as far as I can tell.
     
  25. davide445

    davide445

    Joined:
    Mar 25, 2015
    Posts:
    138
    Not sure if this is the thread to discuss it, but from this tech document since release 1.9 they allocated automatically where possible their stream processing model on GPU.
    What I know for sure is I was able to simulate using the free editor 500.000 particles in realtime on mine old HD7950 GPU and oldest i7-870 CPU, something I suppose impossible using Shuriken from my experiments with it.
     
  26. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    @davide445 Currently PAPF's not going to be able to do that without substantial hackery, the systems designed more for looping ambient effects. Eventually the plan is to support more generic one shots like those with a threaded/gpu hybrid system but that's a while off.

    @TheBullet I'm still working on a fix for Unity 5.5 compatibility, I expect your color issue is in 5.5?
     
    davide445 likes this.
  27. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    No, I'm working in 5.4.2f2.
     
  28. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
  29. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    It's a mesh particle field with mesh default as material. I'm using this code to change the alpha:

    Color col = particles.color;
    float alpha = col.a;
    alpha += 1 * Time.deltaTime;
    col = new Color(col.r, col.g, col.b, alpha);
    particles.color = col;

    In the inspector the color of the particle field changes, but in the game the particle field disappear and I can't make it reappear even changing the color manually, once I've run that code it doesn't react.
     
  30. DTek

    DTek

    Joined:
    May 29, 2013
    Posts:
    15
    I purchased this quite some time ago, never got to using it. I opened it today and whenever I'm running it, I get :

    Code (CSharp):
    1. GetComponentFastPath is not allowed to be called during serialization, call it from Awake or Start instead. Called from MonoBehaviour 'PABillboardParticle' on game object 'BokehField'.
    2. See "Script Serialization" page in the Unity Manual for further details.
    3. UnityEngine.Component:GetComponent()
    4. PAParticleMeshGenerator:OnBeforeSerialize() (at Assets/PopupAsylum/PAParticleField/Internal/PAParticleMeshGenerator.cs:44)
    Any clues ?
    Also, would it be possible to make a few short video tutorials ?
    For example, I need to create a smoke effect that would work with an ortographic camera.
     
  31. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Hi DTek,

    What version of Unity and Particle Field are you using? PAParticleMeshGenerator.OnBeforeSerialize() has GetComponent<PAParticleField>() in it which will be throwing that error, but I haven't seen it be an issue before.

    I've got a few example fields from myself and a couple of other folks that have some neat tricks, it's not videos but it'll give some tips on how to the system can be tweaked to whatever you need, at some point I really want to gather them up and share them on github.

    For a smoke column I'd go for a local space cylinder field, enable the alpha edge mode, set it with low speed and a high value in the Y component of force, I'd enable spin, spin variation and size variation and use the transparent shader with a smoke puff texture, and maybe a bit of turbulence
     
  32. Nearo1

    Nearo1

    Joined:
    Jul 20, 2015
    Posts:
    7
    Hi, Greeting
    I instantiate PA particle and attach on VR camera eye dynamically, It works very well in unity editor mode(5.5),
    but when I build game, and run execution file, the particle will stick on my camera,
    It is very weird, the result in build game is not same with in unity editor,
    my camera is create on runtime, so I can't create a PA particle under camera in editor view.

    Here is my code :
    if (Input.GetKeyDown(KeyCode.A))
    {
    //_cloud = Instantiate(cloudPrefab);
    _cloud = PAParticleField.Create("cloud").gameObject;
    _cloud.transform.parent = MyVRCamera.Instance.Eye;
    }

    Particle always stick on my camera, just like Simulation Space 'Local',
    but logged the setting value is 'World'

    Thanks for any reply~
    My purchase ID is #3xxxxxx08
     
    Last edited: Mar 4, 2017
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @Nearo1 Just some friendly advice. You might want to edit your post and remove your invoice ID. Not a good idea to give away your invoice number publicly.
     
    Nearo1 likes this.
  34. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    hi @Nearo1 sorry its such a late reply, I didn't get a notification!

    PAPF makes use of Unity's shader_features, where features/keywords that Unity decides aren't being used are stripped from shaders at build time to reduce build size. In your case the WORLD_SPACE keyword is being stripped because at build time no field was using it.

    A simple solution is to add a field somewhere with the settings you want and make sure it gets included in the build, a more complicated but less hacky feeling solution is to use a shader variant collection which tells Unity what keywords to ensure are in the build, the documentation for creating and using one is here, along with a bit more in depth description of stripping process
     
    Nearo1 likes this.
  35. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, I finally replaced Particle Playground with PAPF.
    The result is amazing!

    I was checking the profile in play mode and I saw an allocation of 0.7k from PAPF.
    I dig a bit in the code and the cause of this is this line in the SetShaderValues:
    Code (CSharp):
    1. renderingMaterial.shader = shader;
    I don't know if this allocation is happening only in the editor. Could you confirm if you know it, please?
    Anyway I changed that line with this:
    Code (CSharp):
    1. if (renderingMaterial.shader != shader) {
    2.     renderingMaterial.shader = shader;
    3. }
    The allocation is gone, and everything seems to be working fine.
    I also changed the similar code 2 lines before.

    Please let me know if you think this change could have some issue. Otherwise, would be useful to have it integrated into the next version.
     
    Arkade, castor76, ZJP and 2 others like this.
  36. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Can we get the Unity 5.6 warnings with PA? It's working but has annoying warnings all over the place. Also can author confirm issue above?
     
  37. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    This forum never seems to send notifications even if you're subscribed to a thread, so will try this:
    @popupAsylum

    :)
     
    castor76 likes this.
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
  39. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes, you have to open the thread every time you receive a notification, otherwise the system will stop sending you new notifications. Anyway, I'm surprised how many time asset developers forget to check their main forum threads periodically...
     
  40. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Yep *and* one has to be logged in... which the forum seems to forget periodically that you said ”remember me” = ironic!
     
  41. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Since I'm posting here, anyone know whether/how PA Particles can be (a) affected by image effects and (b) integrated with Tenkoku? (Yes I know radically unrelated questions ;-) )
     
  42. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I can answer you only for point a. I'm using PA Particles with fullscreen image effects without any issues. But it depends what image effect you are referring to. The ones that make use of depth buffer (for example Depth of Field) usually don't work well with transparent materials (and transparent particles too).
     
    Arkade likes this.
  43. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Thx @mcmorry !
    Any chance you (or others) have thoughts on motion blur compatibility? Specifically I'm using Amplify's implementation atm.

    Took a quick look at your website. Evonite looks pretty. Surprised I couldn't spot a video (on website or AppStore). Good luck!
     
    mcmorry likes this.
  44. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    About motion blur I suspect it will not work with particles as they should write in the motion buffer. Amplify Motions auto detects mesh objects to track or you can specify manually what objects to track. But I don't think PS Particles could be tracked, as it animates the particles directly in the shader. Probably it would require a specific custom implementation.

    About Evonite, I'm happy that you like it. Yes the videos are only on YouTube, and something on the Facebook page, but soon we will have a dedicated website for the game.
     
  45. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    Hi folks sorry for the recent silence, notifications are indeed awful.

    There's a new version headed to the store now with @mcmorry's allocation fix and the warnings removed in 5.6

    @Arkade currently the particles don't write to the motion buffer used in motion blur image effects but particles are aware of their velocity so I'll see if this can be added, seems like it should work. I haven't used Tenkoku but I'm definitely interested, what integration would you be looking for?
     
    mcmorry and Arkade like this.
  46. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Hey, @popupAsylum thanks for replying! (and thanks again to @mcmorry as your beautiful secretary ;-P )

    Re. Tenkoku, it has integrated weather systems for rain, snow, fog and lightning which are activated, etc by it. PA Particle Field is great for snow and rain (maybe fog?) so it'd seem like a great fit! (caveat: I've not investigated an integration yet -- just one of those wish list thoughts as I was writing :) )

    Re. motion blur, that'd be super! Although I'm using Amplify Motion atm and it has its own motion vector implementation (since it predates Unity's), I wouldn't mind switching over (if performance wasn't too badly impacted).

    Thanks again!
     
    mcmorry likes this.
  47. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi pop.

    I was just wondering about the billboard particles that faces the camera. I can see it does try to face the camera and it does work to some extent, it behaves a bit more wildly ( if I can put it that way) on rotations when they are near the camera.

    I can understand to some degree that why they spin around, but they seem to spin a lot more than Unity's particle system. Can you talk a bit more about that? It might be that Unity's particle may be using some kind of slightly different method for making them facing the camera so they try and compose more of their original orientation?
     
  48. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    @castor76 the simplest approach would be to enable the custom facing direction and set it to face the camera plane in Update i.e -Camera.main.transform.forward

    Internally the switch between camera facing and custom facing is a lerp on the _UserFacing property of the shader, if you we're up for modifying the PAParticleField.cs code a little you could blend between the camera plane and camera facing by modifying where the _UserFacing value is set (around line 1076) to a value that's between 0 and 1
     
    castor76 likes this.
  49. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    103
    @popupAsylum Hey Mark using your Spacedust example and WorldSpace as the Simulation space how would I slow down the particles? When my object is moving at it's normal speed the particles are moving too fast for the effect I am looking for.

    Also is just enabling and disabling the component the best way to start and stop the particle system?
     
  50. popupAsylum

    popupAsylum

    Joined:
    Apr 7, 2014
    Posts:
    119
    hi @Justin-Wasilenko The field in the space demo has a script attached called Stardust which controls the force on the field which then controls how fast the particles move, it monitors the difference in position between fixed updates an applies force in that direction. You could add a new public or serialized float for speed to multiply that difference value by to slow it down, then if needed increase the speed multiplier on the field itself to make it more blurry.

    PAPF's got a few timers for moving the simulation along, to stop them being updated enabling and disabling is fine, then it'll just resume when its re-enabled.
    If you need to stop it's timer updates but still affect other things like color there's not a convenient way of doing that right now but currently you could call Simulate(-Time.deltaTime) to keep the simulation at the same point in time
     
    Justin-Wasilenko likes this.