Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

VFX particle mesh material?

Discussion in 'Visual Effect Graph' started by laurentlavigne, Sep 24, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,793
    Output Particle Mesh outputs meshes, that's nice. Maybe it's fast enough to do grass. Have you folks tried?
    quick test with 10k particles show same performance as shuriken when using Particle/standard unlit or event lit which is a bit surprising since the output particle mesh node is unlit.
    How do I change the default shader?
    now idea where to connect the blue box
    upload_2020-9-24_0-55-8.png
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    549
    Hey @laurentlavigne ,

    The Output Mesh is a different context, it doesn't output particles, but rather single meshes. For example, maybe you want your particles to circle around a sphere which moves around and it's easier to sync it within the graph rather than having a sphere game object and animate it via C# and feed its position into the VFX Graph. You can change its shader simply by assigning a new shader or Shader Graph here:


    As for mesh particles, you can change the default shader of the Output Particle Mesh in a few ways.
    First of, you can change thing like the Blend Mode to make the particles Opaque, use alpha-cutoff, etc. directly in the output:


    A few other options are available in the Inspector when you select the output (things like culling, shadow-casting, etc.):


    And last, but not least, we have an experimental integration with Shader Graph if you'd like to do something more custom (i.e. fresnel effect).

    You can go to Preferences and enable the VFX experimental features:


    This would enable you to assign VFX Shader Graphs directly in Output Particle Mesh:


    Exposed properties in shader graph will appear as inputs on your VFX output.

    Hope this helps!
     

    Attached Files:

    SA107 and laurentlavigne like this.
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,793
    Thanks I didn't even know about a node inspector.
    Compute culling... Even in URP?
    I dunt understand VFX shader graph, I could poke around for days but I'd rather work off an example. Do you have samples on GitHub ?
     
  4. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    549
    Yup, the VFX itself is using compute shaders, which is why the VFX Graph requires compute-capable devices. The URP integration is still being worked on and is not production ready. Even when it becomes production-ready, it will still only target devices which can run compute shaders, and not the whole range of URP-supported devices (though in the long run we plan on supporting VFX CPU particles).

    Yup, we got these samples.
    The Magic Book and the Bonfire samples (if I remember correctly) use the Shader Graph integration.
     
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,793
    Fantastic! Thank you.

    My question about compute culling was: since URP does culling on the CPU does vfx graph also do culling on the CPU?
    And while talking culling: how would I set the vfx graph to cull out particles beyond a certain distance?
     
  6. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    549
    Per-particle culling is on the GPU. CPU culling would be for the VFX component itself based on its bounds which you set in Initialize.

    A bunch of ways you can do this. For example, you can check the distance of particles compared to the Main Camera Transform and Set Alive to true if they are closer than a certain threshold, and false if they are further away.
     

    Attached Files:

    laurentlavigne likes this.
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,793
    How about depth instead of distance?
    i see the node exists so maybe it's cheaper to calculate?
    I see it's a position so maybe it's xyz, can you explain?
    i think the documentation page is broken, there are more nodes than this in the vfx graph
    upload_2020-9-29_12-53-44.png
    searching depth is not returning anything but that node exists
    upload_2020-9-29_12-54-57.png


    why doesn't depth connect directly to compare? doesn't depth value represent the Z value from the camera?

    upload_2020-9-29_12-34-58.png
    what is yellow and blue?
    suggestion: if the color indicates the N in floatN then optinally display as multilink like ASE
    if that's too much work, you can alternatively tooltip the link with its type or dimension
     

    Attached Files: