Download

How to set spawn location in Niagara using a alpha texture?

So want to be able to feed a black and white image to a Niagara system and have the starting location of the particles correspond to the white areas of the image. So for instance I could feed the Niagara system the Unreal U logo and have it spawn particles so that they for a U. Has anyone done something similar to that? I’d like to be able to randomly spawn them anywhere along the white areas of the image as opposed to just being a grid. I’ve thought about just spawning them everywhere and then just killing the particles that fell outside the area that I wanted. That solution seems more straightforward to me, but i can’t really get that to work either.

Anyone have any ideas?

So I have this working a little bit, I created a new Niagara Module that converts the particle’s world position to uv space and samples the texture’s value at that position and kills it if it’s not over some threshold. Then I just put that down the line from a box location module and set the particle spawn rate real high.

This kind of works but is far from an ideal solution. I’m doing this on a very large scale and the nature of my image is such that there is way more black pixels in the image than white. Which means I have to set the spawn rate ludicrously high because 90% of my particles are just getting killed off. If there was a solution that instead of just killing of particles in the wrong place would let me move them to a random valid location that would help me a lot. I’m open to any suggestions.