[UE4][Niagara] Emitting Particles from Material

Hello

Recently I’ve been experimenting with mesh dissolve effects and trying to emit particles based on logic inside material.
Inspired by God of War’s mesh dissolve effect and GDC Vault - Beyond Emitters: Shader and Surface Driven GPU Particle FX Techniques.

I was wondering if there are ways to achieve something similar out of the box in Niagara?

This is my progress so far.
ezgif-7-af1cd5e3699c ezgif-7-a2041149a484

Let me know what you guys think :slight_smile:

Cheers!

12 Likes

This looks so cool, I’ve been trying to achieve this but in Unity with Shader Graph + VFX Graph. No results :’(
It would be awesome if you can share a little bit of your process :'D
Thanks for sharing!

Hello, I haven’t used Unity so don’t think I can provide any tips for it. From what I’ve seen online, Unity is always way easier to use when it comes to implementing GPU techniques (Unreal is way harder to work with ^^’)
For Niagara, we can implement custom data interface in code which can then be used by the Editor.
This includes stuff from EmitterSpawn to ParticleUpdate, almost everything can access the interfaces.

If you watch the GDC talk I referenced, the basic requirements are

  1. We should be able to store the rendered pixel data into a buffer (I used ByteAddressBuffer). I am sure unity lets you do this. I am storing particle world position and number of particles to spawn atm. We should be able to store ScreenUV and use that to extract data from Niagara’s GBuffer interface. I am also using world position directly so that I can emit particles from Transparent objects too.
  2. We should be able to extract the particle count from GPU buffers (buffer readback). This is needed because Niagara determines how many particles to spawn on CPU. This can cause stalls if we try to read the GPU on same frame so I do that on next frame which adds one frame delay to particle spawning.
  3. So once I have the particle data buffer and particle count to spawn I can just send that data through my custom Interface to Niagara :slight_smile:

For supporting writing to custom buffer you have to jump a lot of hoops in Unreal :frowning: , I think that should be easier in Unity. I am doing a depth only pass and outputting the data in to a buffer instead of using render targets.

Let me know if you need more info :slight_smile:

Cheers!

4 Likes

UE4 Niagara 粒子采样模型贴图位置 - 知乎 UE4 Niagara 仿蜘蛛战衣充电效果 - 知乎 You can refer to these two links, they are in Chinese. They use a huge number of particles to make edge judgments

2 Likes

Really cool effect :smiley:

One problem that I have with this method is that whenever we change material we’ll have to update Niagara logic too?

Apologies if I missed something ^^’