Friday, December 1, 2023
HomeVisual EffectsNiagara GPU particles index - Actual Time VFX

Niagara GPU particles index – Actual Time VFX


Hello,

I spawn a bunch of particles that lives without end and I must learn attributes of particular particles in the identical emitter utilizing Particle attributes reader.

I seen that the indexes of particles change continually when you’ve gotten greater than 64 particles in GPU mode. ( doesn’t happen on CPU mode or with lower than 64 particles )

Since you may solely use particles indexes to learn an attribute, I want the indexes to stay the identical in GPU mode.

Anybody has a workaround for this situation?
Thanks!


Thanks for the reply!
I attempted getting the ID from an index on spawn and storing the worth, however plainly it’s getting invalid and defaults to (0,0)

image

If you happen to’re getting the ID from “particle index” (exactly “Execution Index”, not “UniqueID”), be sure you get it throughout Particle Spawn stage (Get ID at Spawn Index) or solely on the first body throughout Particle Replace stage (with Transient.FirstFrame because the bool to pick between the freshly obtained ID and already saved ID), as a result of Execution Index additionally shuffle much like ID.

Once more, courtesy of Niels of the information concerning the Niagara particle ID.



1 Like

Haaa I see,

Let’s say I need the particle that spawned earlier than as ParentID.
Can you employ Execution Index -1 ( and ensure it doesn’t go under 0 )?
Or will execution index provide you with arbitrary numbers ?

I additionally came upon there’s a node referred to as Get Particle Index From ID Desk that allow you to go the spawned index and offers you the present index and that labored for my use case as properly.

AFAIC, -1 index begets “false” legitimate output from PAR Get node. You may both do a max(index, 0), or kill the kid particle if PAR Get provides invalid output by setting false worth to the “Alive” attribute. Nevertheless, It is best to do a logic AND operation between the particle’s present Alive state with the PAR Get legitimate output to keep away from “reviving” a useless particle (Niels advised me about this bit :wink:)

I haven’t tried Get Index from ID Desk but, sounds fairly enjoyable.



1 Like

Hey!
I attempted utilizing Get ID at spawned index utilizing max(0, execution index – 1) to get the guardian.
Whereas this works on the GPU now, the CPU mode doesn’t work any extra. (IDs are unsuitable after a specific amount of particles)

GPU Outcome

CPU Outcome

The execution index appears tremendous on each CPU and GPU

Any thought on tips on how to make it work on each CPU and GPU?
Thanks!

I want some clarification first. After we discuss “Execution Index”, it’s represented in Niagara Debugger as “Particle(n)” when “Present Particle Index” is enabled AND there’s a legitimate particle attribute to be displayed. So I’m not positive the way you retailer that “ExeIndex” attribute as proven in your screenshot. If I perceive appropriately it needs to be your customized particle attribute.

hey!
sure, to be clear I’m doing a spawn burst as soon as with particles that dwell without end.
In my display screen shot I used to be outputing the Execution index to a customized int attribute and show that attribute.

That being stated, I additionally tried the identical utilizing the debugger choice “Present Particle Index” and in addition utilizing UniqueID as a substitute of execution index to get the earlier particle.

In every case, the order is okay and I can get the proper ID on GPU, however on CPU the order remains to be good, however the earlier ID is unsuitable.

Additionally observe that it’s breaking on the CPU when you’ve gotten over 512 particles

Lower than 512 particles:

Greater than 512 particles:

At that time, the indexes goes loopy and the parentIdTag ( worth from Get ID at spawn index) is unsuitable.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments