I have some water particles flying around the scene and I’d like them to draw to a texture/render target when they hit the ground. Is there a way to either write directly in Niagara or output the locations back so the main game can do the writing?
Not really. But you can set up a scene capture 2d to only render the particles.
So essentially set up the hit event of the particle to spawn another emitter that isn’t visible to the player but is visible to the owner - make the actor with the scene capture the owner.
And that will render the particle into an RT you can then use at a minimal cost - because you disable all settings and only render the specific particle.
Not the way I was thinking about it… but playing with a Scene Capture and a Render Target right now… I need to change how I was thinking about approaching the problem to “think in Unreal” more, but I think I can make this work. Thank you!
Of course. You have selection a methods to do that.
One way would be writing a small rasterizer in niagara by using neighbor grid 3d to spatially hash your particles onto a 2d grid, size of your output render target you want particles to be rendered in. Then run a simulation stage, that iterates over render target, and for each cell, tap into corresponding neighbor grid cells, get the list of particles, iterate through all of them to derive the final color to be written to render target. This is going to be incomparably faster than messing with a scene capture. @nullterm
Likewise, you can use scatter method instead of gather, and use neighbor grid 3d as an output, incrementing a counter for each particle in cell , and then diving the counter by some value, clamping it and writing to output target.