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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Butterfly particles, broken vertDisplacement shader.

Discussion in 'Shader Graph' started by WeItor, Mar 11, 2022.

  1. WeItor

    WeItor

    Joined:
    Nov 12, 2020
    Posts:
    4
    Hello! I'm trying to make a particle system that has butterfly mesh particles with animated vertices through shader.

    I have come a pretty far way by making it work on a single mesh(not a particle system). But as soon as I use it on the renderer module in the particle system it breaks. Butterfly_wrong.gif
    The shader I made is seen below: vertex_shader_shadergraph.png
    And the desired result per particle is this: utterfly single mesh.gif
    On each particle in this system: butterflies_no_shader.gif
    I am using unity 2020.3.18 and the URP, does anybody know where I went wrong or how this is fixable?
    (I am quite new to shaders and particle systems)
     
  2. Jzubah

    Jzubah

    Joined:
    Jan 26, 2018
    Posts:
    4
    What breaks? it seems fine.

    Maybe leave more details?
     
  3. WeItor

    WeItor

    Joined:
    Nov 12, 2020
    Posts:
    4
    Well, to be honest I dont know exactly what breaks or if it is even "broken". But it is definately not the desired result. All the particles start spazzing around instead of flapping their wings as shown in the example and flying around in the behaviour represented above. On single meshes the shader works but for some reason that behaviour is not the same when I place the exact same shader and the exact same mesh in a particle system renderer module.

    So i think my question needs to be rephrased to: How do I achieve the results, I get on a single mesh, in a particle system.
     
  4. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,123
    Never tried such animations, so I don't know how to correctly fix it, but I can tell you whats the problem - it's most likely particle batching. I mean, particle system generates single mesh from all particles, so your object space is not valid as it's not middle of particle, but instead something like barycentric center of all particles. You can confirm this by generating only one particle - it should work.
    To fix it you must ensure that each "particle" somehow knows it's center.
    // edit: It might be also possible to enable instancing, so each mesh is "separately" rendered on GPU
     
    Last edited: Mar 26, 2022