Niagara sim stages possible to evaluate post pre pass but before base pass?

I am trying to use Niagara sim stages to generate a screenspace buffer which will be accessed by materials in the environment, I need access to the depth buffer so it needs to run after the pre pass but needs to update the output texture before the base pass so the materials can access it but if I add camera access or depth buffer access to the sim stage it forces it to evaluate in PostOpaque which means the materials in the base pass are accessing the result from the previous frame.

I’ve tried forcing the tick group but it doesn’t seem to make a difference, anyone have any ideas?

Assuming you’re using a GPU sim, I don’t think there’s a straightforward way to control when Niagara evaluates. You’d need to write your own render passes, which would be pretty tricky.

You can use Renderdoc to see how all this works. There are dozens of passes evaluated on the GPU each frame. From what I recall, Niagara usually evaluates early in the sequence, but I have no idea how to control exactly when.

Can you frame this problem in a more asynchronous way? Can you evaluate the Niagara piece on one frame, and the material part on some later frame?

Thanks, I used RenderDoc to identify the problem in the first place, I can get it to dispatch the job at the start of the frame or the end of the frame but for my purposes it needs to happen immediately after the pre pass to access the current depth buffer but before the base pass so that the opaque materials can make use of the current value.

Essentially what I am after is the world space distance to all the particles in a screenspace buffer that materials can access to control layer blends

So I’ve looked at the code and looks like there is currently only 2 stages the GPU sim is dispatched either PostOpaqueRender or PostInitViews but neither of these options fit my purpose as the depth buffer will be out of date but I’ve at least been able to make it somewhat usable by calculating the screen UVs to sample the texture based off the previous frames clip matrix it stops the texture sliding over the surface when the camera moves but does mean I get gaps where it was occluded on the previous frame.

Just stumbled across this: UNiagaraDataInterface and FNiagaraDataInterfaceProxy have methods for injecting RHI commands at specific points in the cycle. (I have no idea how to use them; just noticed they are there…)

Maybe that’s a way to do it?