Search Unity

[Official] Particle System [Shuriken] Improvements

Discussion in 'General Graphics' started by bibbinator, May 26, 2014.

  1. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I mean, if Shuriken is on hold I guess Over Lifetime / Over Duration is something that cooould be somehow addressed in VFX graph (allow users to pick an icon or something for a property? Who knows!). Tooltip will do the trick tho!

    Glad you like the Curve Random param idea! I used that solution a lot on another game I worked on in a custom engine and it worked beautifully.
     
    richardkettlewell likes this.
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    I've prototyped this feature, let us know what you think of it: https://forum.unity.com/threads/mesh-weighting-feature.1088545/
     
    Archanor and karl_jones like this.
  3. Archanor

    Archanor

    Joined:
    Dec 2, 2013
    Posts:
    575
  4. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Hi guys! I have a unity box primitive with rigid body on it and shild shuriken particle. Cube is being launched by adding force to it`s rigid body. it behaves predictibly but child shuriken particle does not follow along with the cube. it falls off the launcher and goes straight down while box is flying away in intended direction. i googled the problem but no luck so far.
    Any advice would be much appreciated.
    Thanks!
     
  5. Archanor

    Archanor

    Joined:
    Dec 2, 2013
    Posts:
    575
    @musolo You might want to make a new thread for this with included screenshots of the particle system settings and explain what you're trying to do. The particle system's Simulation Space might need to be set to Local depending on the effect you want.
     
  6. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    In which section should i make this new thread? Didn`t find particles related category
    Thanks!
     
  7. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    What about emitting prefabs? In which version of Unity Shuriken have this option?
     
  8. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    What's the suggested workflow for creating Shuriken effects alongside Animated objects (Animator)? I have no idea how I can preview both side-by-side in the editor. I tried timeline but Shuriken controls seem to be very poor (emit per distance doesn't work when Timeline is playing and effect is selected, whole effect is restarting if Control Track is longer than effect's Duration, Duration in general seems to be ignored (?), Timeline doesn't take Start Delay into account at times)?

    Edit1: I tried using this package from official Unity examples but it overrides Duration of particle systems setting it to the length of the track clip.

    This won't work for me as I am using Duration to define how long are my starting param curves (Start speed, start size, defines the duration of particle emission). Whenever Duration changes it messes all my effects.
    https://github.com/keijiro/TimelineParticleControl

    Edit2: I managed to get this working with some c# plumbing, although I have to say, I was hoping such a simple and fundamental feature would come with Timeline out of the box.
     
    Last edited: Apr 14, 2021
  9. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    505
    But "Visual Effect Graph" doesn't work with standard pipeline. It worked in some versions of unity(not officially), but now it turned off.
     
  10. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I've got a question on this one. My understanding is that VFX Graph will replace Shuriken although VFX Graph roadmap is only mentioning High End Mobile Devices support. What does it mean for the future of particles and mobile devices? Will I be able to use VFX Graph in the future on all mobile devices in the future? If so why is that not on the roadmap? Compute support on mobile is not something that will be widely available anytime soon.

    Are you planning to bring full CPU simulation mode for the VFX Graph?

    Cheers!

    Also, this is the roadmap I was looking at https://portal.productboard.com/uni...ing-visual-effects/tabs/9-visual-effect-graph
     
  11. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Yes, this is accurate, although when that may be, and what "replace" really means, are very open questions.

    Yes, is the simple answer :)

    Only the VFX Graph team can answer that. I recommend asking them about it in their forum so they can say why it's not on there, and what their timelines currently are for it: https://forum.unity.com/forums/visual-effect-graph.428/ (and yes you have the correct link for their roadmap)

    To add a bit more detail to this topic, I don't see feature parity happening for some years yet. Unity 2021 is almost done at the time of writing this, and I've not seen any plans to add a CPU path for VFX in Unity 2022. As you pointed out, it's not even on their roadmap.

    Also, and I cannot stress this enough, we will not be removing Shuriken while there is significant usage among our users for it. It remains an important technology for all our users on the Builtin Renderer, and the majority of our customers using URP.
     
    michalpiatek, Archanor and karl_jones like this.
  12. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Would it be possible to have Copy/Paste on individual submodules? It's a looooot of work copy/pasting individual settings one by one!
    shuriken_copy_paste_module.jpg

    Also, context menu for gradient Color always opens on the left side of the window. It should open below the cursor. Here's a super duper image to illustrate:
    shuriken_gradient_color_copy_context_menu.jpg

    I right-clicked where the black X is but context menu opens up 2000 miles away. Ain't fun!
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Funny you should mention this. I know @richardkettlewell created a change the other day to add this very feature ;)
     
  14. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Could you submit a bug report for this?
     
  15. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Done and dusted. Case 1334328
     
    richardkettlewell and karl_jones like this.
  16. FunkyMartin

    FunkyMartin

    Joined:
    May 26, 2017
    Posts:
    1
    I've been trying to find a way to get consistent, distance based UV mapping on particle trails within shuriken?
    I've created my desired behavior in UE4 as an example.
    ribbon_trail_niagara_works.gif
    Here I'm able to make the smoke texture linger and tile completely independent of the parent location and segment density, without any stretching, dragging, or needing to apply a scrolling animation to the effect to counteract movement.

    None of Shuriken's trail texture modes behave like this. The closest one is Repeat Per Segment on the far right in the images below, but that has problems of it's own where the individual segments visibly squash as they despawn.
    unity particle trail texture modes.gif
    There's also no direct control over the texture tiling outside of setting the Minimum Vertex Distance, so that means you can't have a smooth trail with a long tiling texture on it, attempting to tile the material less than once per segment causes the whole thing to get dragged around by the endpoint
    unity particle trail texture modes tile 0.04.gif
    Would it be possible to add distance based UV mapping to Shuriken's particle trails? It'd be extremely helpful to have for any kind of continuous ribbon trail effect, like smoke trails.
     
  17. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I have exact same issues but one thing I will add here is that in theory you can set tiling in the material, in practice this results in dozens of materials sitting in the project as you almost never want to have the same tiling setting across different effects. It's like particle size. Imagine having to set particle size in the material.
     
  18. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    I've prototyped this feature here, but so far only on the TrailRenderer component.
    Please let us know if it fits your needs, and we will add it to the particle trails too before we release it.

    https://forum.unity.com/threads/world-space-trail-textures.1107389/

    Thanks!
     
    Archanor and Moonjump like this.
  19. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I reported this bug and it got closed as won't fix saying it would break effects.
    https://issuetracker.unity3d.com/is...t-to-cone-and-cones-angle-is-above-70-degrees

    I get why it could break old effects but wouldn't a solution be to:
    1. Fix the distribution so it's even at any emit angle
    2. For all old effects convert them so that Radius Thickness is set to 0 for high Angles to mimic old uneven distribution
    3. This would be done at update time when upgrading the project
    It probably is more complex than I think it is but wanted to ask anyway.

    Other alternative would be to have a new shape called something like Uniform Cone. It would have uniform particle spread at all emit angles. Right now there is not a single shape which has adjustable angle and even particle distribution :( Cone works fine at 0 to around 60* angle, hemisphere it only full 90*, sphere is full 180.

    Actually now that I think about it, it's kind of weird that we have cone which goes from 0 to 90, then hemi which is 90 only and sphere which is 180. It should be possible to have a cone which goes from 0 to 180 and covers all those angles. It makes more sense from workflow point of view. Just thoughts!
     
  20. Archanor

    Archanor

    Joined:
    Dec 2, 2013
    Posts:
    575
    Small suggestion here..

    Could Limit Velocity over Lifetime's Drag option support negative values?

    upload_2021-5-30_17-31-25.png upload_2021-5-30_17-42-37.png

    I'm making a directional explosion that also emits a number of smoke particles with a Start Size between 1 and 3. In this case it would make more sense to see bigger smoke particles at the top and smaller at the bottom. So by setting a negative 2 value the bigger smoke particles would be pushed further to look like a cone shape.

    I know there are other ways to get a cone-shaped smoke effect (sub-emitters and Emission over Distance), but this seemed like a simpler way to do it at the time.
     
  21. Archanor

    Archanor

    Joined:
    Dec 2, 2013
    Posts:
    575
    I just want to mention some of my most annoying and common problems with particles and asset publishing:

    1. Effects with Soft Particles enabled in URP are just plain invisible in builds (but not in the editor), and I have to answer so many emails about this problem every week, even if I write about it in every possible documentation, forum thread and support websites. I don't believe the same problem happened in in the Built-in Render Pipeline.

    2. Particle systems that use Mesh renderers (possibly with the 'Particles/Lit' shader) and have Enable Mesh GPU Instancing in mobile and WebGL builds will have invisible particles and instead emit strange, blank mesh particles in 0,0,0 in the scene. It took me some time to figure out why this was happening. Maybe there needs to be a warning or something here as this feature is on by default.

    3. This is more of a feature request tbh. Something that would be really useful is a Roll feature in the Renderer when using Stretched Billboards. Right now it supports textures that go left to right, but in some cases you have spritesheets going bottom to top.

    @richardkettlewell Lastly I'm just curious if you're any closer to finishing a Standard Particle shader for shuriken in HDRP?
     
  22. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Thanks for the feedback :)

    1. sounds like a bug? Is there a bug report for this? Please send one if not

    2. definitely a bug - platforms that don’t support gpu instancing should fall back to the cpu path - please send a bug report

    3. so an option to rotate the texture 90 degrees?

    There is no work happening on a particles shader for HDRP, sorry, we just have the add-on set of ShaderGraphs. You can install them via the package manager after selecting the HDRP package.
     
  23. Archanor

    Archanor

    Joined:
    Dec 2, 2013
    Posts:
    575
    1. I just searched and it looks like this problem, but for newer versions of URP. Usually happens when Depth Texture is not enabled in the Camera/SRP settings for the build. I'll see if I can make a new project and report it.

    2. Will do

    3. Yep! Combined with the Flip XYZ I believe you can then make it face any direction.

    Alternatively, adding an extra "Face Camera" option for the Mesh Render Mode that uses the Velocity Render Alignment would let you make a sort of Stretched Billboards (if you just use a quad as the mesh), as you can set the 3D Start Rotation to anything.

    If you keep building on this idea, having Speed Scale as an option for Meshes would be pretty sick.

    upload_2021-6-13_16-3-7.png
     
    richardkettlewell likes this.
  24. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    How can I play a sound effect each time a particle dies or gets spawned at the location of its birth/death?

    I am tracing current particle count to detect particle death/birth but in cases where particle count is stable (equal particles die and get spawned each frame) it's impossible to trace that and spawn SFX every time and I don't know how to get the location of a particle.

    Ideally I'd love to subscribe to an event which is fired off whenever that happens or have access to some sort of a structure which gives me all the info I need for a singular particle system and/or a whole tree of particle systems making a singular VFX.

    The reason I need location of spawned/killed particle is for a complex use case where particles are projectiles but there are more use cases I have which are much harder to explain.
     
  25. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    We often discussed an event system for the particle system - it would be perfect for use cases like this. But unfortunately we never did it before vfx graph became the focus.

    There is an example at the bottom of here that shows how to detect particle births (hopefully robustly) https://docs.unity3d.com/ScriptReference/ParticleSystem.SetCustomParticleData.html

    Perhaps it can solve this for you..
     
    michalpiatek and karl_jones like this.
  26. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Huh, I somehow missed this part of the API. I'll try and see where this gets me, looks promising tho! Thanks.
     
    karl_jones and richardkettlewell like this.
  27. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I have noticed that in the editor playback of particles is much choppier than in game, as if it had a much lower tick rate per second compared to game mode.

    What I mean by that is there are some properties which are updated at a fixed time step in the editor (size over lifetime, all custom vertex data curves). I only noticed this when using a mesh particle. So say my PC renders 60FPS but particle size would only be updated at 25fps rate. Another example - I use Custom Data curve to offset texture coordinates and it also only gets updated once every few frames.
    It becomes increasingly worse when I am using low Playback Speed or low Simulation Speed. Whenever I'm setting Playback Speed to something like 0.2 you can literally see that particles would get updated like once every second or even less often with lower values.

    Again, this only happens in the editor and is really hard to work with. Everything is smooth as butter in the game.
     
  28. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    We update the particles at a fixed timestep in Edit mode so that we can do the super-slow-mo interpolation when you scrub the playback time. I suppose the update steps can be noticeable in some situations. Is that what you mean?
     
  29. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Correct, this is what I am experiencing. I've sent you a PM with a link to a video showing the issue.
    I have an itch it might only be the case with complex curves and when curves are simpler (auto interpolation on all keys) it seems to be mostly gone but I really didn't have much time to investigate this in detail
     
  30. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Timeline question again. Is there any way I can make Rate Per Distance work in the editor while playing / scrubbing through the timeline? I have a custom Particle System track&mixer and I am using ParticleSystem.Simulate function to play the effect and sync it with the time marker. This works flawlessly for any emission type but the Rate Per Distance.

    Particle System is not emitting any particles at all. It seems to be working only if I attach a RigidBody to parent gameobject, set it to Kinematic with Interpolation turned on and have that game object selected. If gameObject with RB is not selected, particle system won't emit any particles. I also tried to change the velocity source from RigidBody to Transform but it doesn't work either.
     
  31. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    I'd say if it's not working, submit a bug and I'll see if I can make it work. It's probably just something that's been overlooked when implementing the Timeline/Shuriken integration.
     
    michalpiatek likes this.
  32. blacksmil3

    blacksmil3

    Joined:
    Oct 10, 2021
    Posts:
    1
    Is there any way to use the same noise-pattern (seed?) between two particle systems? Could be useful for syncing the movement of systems.
     
  33. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    I think if you set the auto random seed to false and set the same seed it will sync the noise fields
     
  34. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Is there any way I can set Custom Data name fields from script? I have a lot of shaders which are using Custom Data for different things and it is really hard to memorize which shader does what. I wanted to make a tool which sets Custom Data fields to the correct type and names all the fields based on what the shader does. I can't find any public API for accessing those fields tho.
    image_2021-11-22_142054.png
     
  35. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
  36. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
  37. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Ah! Yeah, that does appear to me missing from the exposed APIs.

    The answer for "can you change them from script" is yes, but you'd have to set them via c# reflection. This is something I'm absolutely terrible at understanding so I can't really give you any concrete advice on how exactly to do this. However the property fields for those labels are
    colorLabel0
    ,
    colorLabel1
    ,
    vectorLabel0_0
    thru
    vectorLabel0_3
    , and
    vectorLabel1_0
    thru
    vectorLabel1_3
    . I think it'd be something like (totally not tested):
    Code (csharp):
    1. var customDataModule = particleSystem.customData;
    2. customData.GetType().GetProperty("vectorLabel0_0").SetValue(customData, "Crunchiness");
     
  38. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
  39. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Thanks for the help to both of you. I had an itch I could do it with reflections but last time I had to use it was when I was working with Unity 3.5.7. Time to roll up my sleeves and do it the old school way :D
     
    richardkettlewell likes this.
  40. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    In the manual I found information that I can use Loop and Ping Pong modes on curves and specify how many times it will loop/pingpong over a particle's lifetime. I know how to change curve extrapolation mode but I can't find any place where I can specify how many times curve will pingpong/loop over particle's lifetime. Where I can set this?

    https://docs.unity3d.com/Manual/PartSysUsage.html
    curve_looping.jpg
     
  41. Torbach78

    Torbach78

    Joined:
    Aug 10, 2013
    Posts:
    296
    not a numerical field
    pingpong.png

    here's pingpong on the end node; by remapping manually nodes inside the 0-1 bounds it will propagate the behavior.

    you can enter data on the points themselves (value & position) so you can mathematically work out the repetition if you need precision
     
  42. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Ahaaaaaa! The bit about "specified number of times" got me all confused. As if there was a numerical field somewhere which defines how many loops there are. But this does make sense, thanks.
     
  43. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Thanks for this feedback. I'll tweak the docs wording.
     
  44. Torbach78

    Torbach78

    Joined:
    Aug 10, 2013
    Posts:
    296
    graphing curves navigation is unique (a little constrained) compared to timeline curves in other unity systems/modules. could it get a little polish pass?

    These would be nice if they also could Zoom-out
    • Shift + wheel
    • Cntrl + wheel

    • middle mouse pan works when zoomed in, but it would be nice to have some level of movement unconstrained.. maybe just a 20% buffer outside of the bounds
    • I'm usually looking at graphs that have 50% unused negative range so panning would clearly help that

    press F (frame)
    wheel mouse (zoom out 2 ticks)
    middle mouse pan a little
    = perfect ! :D

    currently in order to throw a value over 100% like this Bezier at time 0.00
    shot1.png

    you have to remap the curve over 1.00 (1.80 shown below) and bring down the other node(s), the more nodes, the more extra work it is
    shot2.png

    im nervous every time my mouse goes to click the final node that are usually < 6 pixels to that ominous 'REMOVE!' button
     
    michalpiatek likes this.
  45. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    What's the proper way to work with UI in the Overlay mode and Particle System? I can't figure it out and I couldn't find anything in the manual. I just can't make it to render and sort properly (or rather at all, it just renders behind).

    Second question is: what's the correct workflow to get the Particle System to scale with different aspect ratios and resolutions? Is there a component I can use to handle these things? Does it scale the Shape only and/or particles themselves? Can I use anchors to somehow do this?


    @Torbach78 I 100% agree with you. Sadly, I reported almost the same feedback a while back and got a reply that after internal discussions this won't be fixed.
    One thing I would add to what you said is that there is no way of setting limits for allowed values in the Custom Data modules. I have to clamp all the data in the shader itself and the worst part is that the real value range is always hidden from the user. They don't know what's the allowed range without looking at the shader code.
     
  46. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    There is an open-source library that makes working with UI and overlay easier here https://github.com/mob-sakai/ParticleEffectForUGUI
     
  47. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    Probably the wrong place to ask but this is very related to a set of old VFX engine tools.
    Is there any way I can force a line renderer to use a HDR colour gradient? Seems odd to be able to have a HDR camera output in URP but no way to have a HDR line.
     
  48. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Not currently. The line colours are sent to the shader as bytes in the 0-255 range, so this would need changing to support HDR colors. It’s an interesting idea..
     
    michalpiatek likes this.
  49. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    I hope the idea is interesting enough to make its way to the next unity release! :)

    To be honest, I'd be great if the colour workflow was unified across the board. From a VFX artist point of view current VFX toolbox colour workflow is somewhat inconsistent. I can have HDR colours on particles in Shuriken only via custom data and custom shaders, build in shaders (shuriken) support HDR emissive but it's an additional texture read even when I don't want to have additional emissive texture (base colour picker should just be a HDR colour picker), Line and Trail renderer colour fields and API only take in LDR values.

    Unity allows and heavily supports HDR PBR rendering (not to be confused with displaying on a HDR monitor!), pretty much every aspect of the rendering starting from lights, ending with lightmapping, GI and post processing is ready to take in HDR values and that's even in URP.
     
  50. michalpiatek

    michalpiatek

    Joined:
    Feb 26, 2021
    Posts:
    81
    @richardkettlewell What are the implementation details of new Texture Scale X and Y in Shuriken Trails module? It only works on the Y axis with my custom shaders. The X scale doesn't affect the tiling at all. Is there a shader requirement here? Both X and Y scale works fine with the built-in URP particle shader.


    Edit: Ahh. I think I remember now that you explained it's like that since it was difficult to implement X tiling for ribbons in a sensible way. Still, would simply calculating distance between previous generated point and multiplying by X Scale work here? It wouldn't be perfect but at least it would do it for some cases. Can always be left at 1 in case user wants to use default (current) behaviour.
     
    Last edited: Jul 18, 2022