Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Visual Effect Graph] Spawn particles from skinned mesh surface

Discussion in 'Graphics Experimental Previews' started by alexandre-fiset, Mar 27, 2019.

  1. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Hi,

    I'm playing around with the VFX graph samples, and while the point cache approach is really nice for static meshes, I can't find a way to spawn particles on the surface of animated / skinned meshes.

    Is there a way to randomly spawn particles on the surface of a mesh other than the standard primitives?
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Hi Alexandre,

    Mesh sampling is not yet implemented in VFX Graph. Static mesh sampling (no need for point cache anymore to spawn on vertices) will be in 2019.2 and skinned mesh sampling is planned for 2019.3.

    The only workarounds to spawn in skinned mesh at the moment are either by generating / uploading a point cache of the skinned mesh at each frame and use it to spawn or by rendering the skinned mesh in a offscreen render target and use its zbuffer for projection.
     
  3. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
  4. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Great :) We will wait for these features before commencing any heavy VFX work on our characters. Our game is scheduled to be released in 2021 anyway, so we're most likely to ship with Unity 2020.X.
     
  5. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    10
    Can we expect skinned mesh sampling in a later version of 2019.3? I had a look at the release notes & played around with the latest version but couldn't find any references to it. Very excited for this feature :)
     
    Last edited: Oct 2, 2019
  6. jslopezb

    jslopezb

    Joined:
    Dec 27, 2018
    Posts:
    1
    Hi, does this still stand? Got the beta but can't seem to find this functionality.
     
  7. Staus

    Staus

    Joined:
    Jul 7, 2014
    Posts:
    13
    I'm equally interested. Can't seem to find this in 19.3
     
  8. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    160
    Is there any update on this? :)
     
  9. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    153
    Any news on this?
     
  10. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    Any update on this?
     
  11. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    584
    I can't seem to find how to use a static mesh as an emitter, is this in 2019.3 yet?
     
  12. MattESqr

    MattESqr

    Joined:
    Feb 5, 2020
    Posts:
    15
    @JulienF_Unity
    Can't seem to find this in 2019.3... as many have already asked what's the status?
     
  13. Eulmiac

    Eulmiac

    Joined:
    Mar 11, 2020
    Posts:
    10
    Me neither... Would love a feedback on this !
     
  14. snoche

    snoche

    Joined:
    Feb 22, 2010
    Posts:
    82
    I needed this too, any update? is on the roadmap at least?
     
    GridWanderer and fandorra4work like this.
  15. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    434
    Are there any news regarding?
     
    GridWanderer likes this.
  16. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    153
    @JulienF_Unity Any news about that?
    Does it will be implemented for 2019 LTS or only 2020 now?
     
    zachlindblad likes this.
  17. zachlindblad

    zachlindblad

    Joined:
    Sep 29, 2016
    Posts:
    39
    @JulienF_Unity Any update on this? Even static mesh sampling would help me move over a few more of my particle systems to VFX graph
     
  18. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    For static meshes you can either bake a point cloud or a signed distance field.
     
  19. zachlindblad

    zachlindblad

    Joined:
    Sep 29, 2016
    Posts:
    39
    @alexandre-fiset Thanks for the suggestions, unfortunately my vfx graph spawns particles from a mesh that's generated at runtime, so using unity's bake tool for point clouds isn't going to work. I could try to process the data async and generate it myself, but given the vertex data is already on the GPU with the mesh, I'd hope I could just use that existing vertex buffer as a point list to draw from.
     
    JasonMa1312 likes this.
  20. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    One year later and still nothing. :(
     
  21. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    10
    1 year anniversary!!!!! :D
    In all seriousness, it'd be nice if we could get some kind of confirmation that this feature is either delayed or cancelled so we can all move on :)
     
    John1515 likes this.
  22. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    Next year for sure.;)
     
  23. ctedin187

    ctedin187

    Joined:
    Aug 20, 2018
    Posts:
    11
    Still nothing? I'd really love to use something that was built into Unity. It's a bit of a hassle installing and using Keijiro's tools. I've had some errors.
     
    haruAegis likes this.
  24. ctedin187

    ctedin187

    Joined:
    Aug 20, 2018
    Posts:
    11
    On a side note, does anyone here know how to rotate (over time) a point cloud "emitter"? It seems that a static point cloud would handle rotation, but all I see is scale and translate x,y,z. Thanks again.
     
  25. rustinlee

    rustinlee

    Joined:
    May 31, 2014
    Posts:
    20
    Can't find static mesh sampling in 2019.4 / 7.3.1. Can you really not emit particles from the surface or volume of even a static mesh in VFX Graph?

    I can't use the point cache baking utility because these meshes are procedurally generated at runtime. This was an important feature of Shuriken.
     
    Last edited: Aug 22, 2020
    Siethu and Ne0mega like this.
  26. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    if it helps you i had the same problem with my procedural spawned terrain. I just used the same height map in my vfx graph to spawn grass
     
  27. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    197
    epic lawl bump
     
    plant_machine likes this.
  28. Artromskiy

    Artromskiy

    Joined:
    Oct 28, 2019
    Posts:
    7
    We need info about it.
     
    Deleted User and vx4 like this.
  29. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Necro-resurrection: is the VFX graph prev 10 only supposed to support static meshes? (considering smrvfx or prev 10 for a project)
     
  30. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Apparently the skinned mesh sampling is in 2021.1. Did not try it out though but would be curious to know if that works well!
     
  31. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Anyone having too much time? ;)
     
  32. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    10
    Just checked, was added in 2021.1.0b10/2021.2.0a9
    Looks very promising!

    Now to figure out how to use it...
     
  33. michaelybecker

    michaelybecker

    Joined:
    Jun 18, 2014
    Posts:
    19
    did you figure it out? also, where are you seeing this node? can't find it in the same version (URP)
     
  34. mfolsom

    mfolsom

    Joined:
    May 21, 2016
    Posts:
    5
    You might have to enable experiemental blocks in preferences/visual effects. I attached a skinned mesh on init, it works like the previous mesh, but so far i can't get it to update / animate. If I put it in the update node it gives strange results.
     
  35. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    10
    Yeah as mfolsom said you need Experimental Operators/Blocks enabled.
    I've managed to achieve good results with a Position (Mesh) block with its Source Mesh setting set to SkinnedMeshRenderer, but haven't yet figured out how to replicate its behaviour with the Sample Mesh operator in order to get outputs other than position.
     
  36. michaelybecker

    michaelybecker

    Joined:
    Jun 18, 2014
    Posts:
    19
    thanks for the helpful replies! alas, I'm blocked by the fact both versions seem to fail to build to Quest using Vulkan - crashes on start - which means I have to stick to the previous Unity version and perhaps Keijiro's solution (https://github.com/keijiro/Smrvfx). But I'll give this a try as soon as these crashes stop happening!
     
  37. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Since nobody answered I'll necro this, you can transform any set of positions by using Get Position Current > Transform Position (use the transform fields to manipulate) > plug into add or set position block.
     
  38. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    10
    Wish I'd seen this tweet from Paul Demeulenaere sooner! Exactly what I was after :)
    https://twitter.com/PaulDemeulenaer/status/1376977896309465095
     
    John1515 likes this.
  39. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Now that it appears to be supported in 2021.1, is there any chance of seeing that feature backported to 2020 LTS?
     
    farfewgiants likes this.
  40. A_Gamgie

    A_Gamgie

    Joined:
    Mar 30, 2013
    Posts:
    9
    Hello all ! I'm using this wonderful feature to sample mesh in realtime. But, I wonder why it is not available to emit from a volume instead of surface, vertex and edge.
    Any idea why ?
    (because actually I would exactly emitting from a volume like the basic geometry we had before)
     
  41. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    You can approximate it by manually setting a pseudo pivot point (or even calculate an average, but then mesh density affects the pseudopivot) and lerp the particles towards that by a random amount.
     
  42. A_Gamgie

    A_Gamgie

    Joined:
    Mar 30, 2013
    Posts:
    9
    Thanks for your answer ! It is reaching my algorithmic limit :)
    Do you have any clue to calculate this pseudo pivot point ? a method ?

    If I follow you, this will work for concave mesh and not concave. If I take a torus for example, its pivot point is its barycenter. And I lerp from here between each point of the mesh, I will end up emit inside a thick disc. Right ?
     
  43. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    There are several ways to go about that, and the way you should go about it has primarily to do with indeed the shape you're trying to achieve.

    Calculate the object center on the CPU (for simple shapes you could take an objects bounds center for example) and send it to the VFX graph via a texture / spawnEvent / Property(just like shader properties, they're the same thing for the most part infact) etc.

    Alternatively you could add all the vert positions to a single variable relative to zero then divide by the number of verts etc.

    For a convex shape you can quite literally indeed do a weighted lerp and you're done.
    For primitives / simple shapes like a torus, you could instead spawn them in a circle, then add random position.
    For complex concaves there is the option of doing primitive shapes "stickman" shaping of the object and adding randomness to the positions.

    For a surface thickness instead of full object volume you can just multiply the positions by adding random position to them, but always in the direction of the center you want. If you need more than one "center" point you could add randomness towards, you can use lerp T inputs combined with distance from manually placed points as to how much random value you add, then add them together. (you can use clamped remapping for example to prevent values inverting when they're outside the area).

    I would strongly suggest prototyping, a good exercise on how to do it i would recommend for example spawning particles in a cone, then using the particles Y position to lerp with how much position to modify, then progress to having two different spawn shapes by using probability sampling & switch nodes for example (assign an ID for each particle with probability sampling via custom attribute, then Get that for the switch and you can pick / choose how many spawn from cone vs other shape for example).

    And if you're not spawning ludicrous amounts of particles per frame, you can do some insanely complex math in initialization, update is what kills you, so try to store all the data you can in init and only use what you must in update if you need very high performance particle systems.

    If you have an actual specific problem you need help with, post it or pm me.
     
    Last edited: Jan 11, 2022
    A_Gamgie likes this.
  44. John1515

    John1515

    Joined:
    Nov 29, 2012
    Posts:
    248
    How buggy is it? Or ow many hours to get all console errors away? knowing unity's betas packages... ;)