Butterfly particles, broken vertDisplacement shader.

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.7957206--1019628--Butterfly_wrong.gif
The shader I made is seen below:


And the desired result per particle is this:7957206--1019634--utterfly single mesh.gif
On each particle in this system:7957206--1019637--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)

What breaks? it seems fine.

Maybe leave more details?

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.

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

Bump. I having the same problem. I’m making a “rat” particle system where the rats wiggle around while moving, based on its world position and a noise. I’m also using shader graph.

This is how it looks on a mesh:
9708740--1386908--rat 1.gif
This is what it looks like on a particle:

I searched a bit and found out about ‘custom vertex streams’, which I tried messing around a bit and it made differences, but didnt fix it

Edit: I found out the order of the custom vertex streams matter, why? Now I might have to find the right order to fix this problem? what the…