1 like 0 dislike


How to emit a bursts of particles intermittently when using "Infinite" mode in PopcornFX v2.2? I found solution for v1.3 https://answers.popcornfx.com/1656/emit-bursts-particles-intermittently-when-using-infinite. But how to implement "Layer flux-functionand "Layer scripts" in PopcornFX v2.2 editor?

Thank you.

by yarik (160 points)

1 Answer

0 like 0 dislike
Best answer

Hi !

You can do that by wiring a custom computation into the 'SpawnCount' property of the multiplier node.

In v1, the "Flux" value you could write to from layer-scripts was acting as a multiplier to the "SpawnCount" property of the emitter.

In v2, wiring something in the "SpawnCount" pin of the multiplier node will override whatever value you've set into the "SpawnCount" property. So you'll need to pre-multiply it.

Here's an example with a curve driving the emission rate of a multiplier:

You can see I exposed the "SpawnCount" pin and wired in a curve sampled over time, multiplied by 100.

Using this curve:

Will produce an emission spike at around ~60 particles/second (because it gets multiplied by 100), and the rest of the time it'll emit roughly 2-3 particles/second.

To expose the "SpawnCount" pin, you can select the multiplier node, and click on the little eye icon next to the property:

And last, Here's how I've setup the "CurveOverTime" node in this example:

The "CursorMode" property is set by default to "LifeRatio", which will not work if your multiplier node is set to infinite (which was my case), so here I've just set it to "Age", which is the time in seconds since this multiplier node was started.

"Cursor Range" is set to 3 meaning the curve will be stretched over 3 seconds, and "Repeat" is checked meaning if the emitter lasts for more than 3 seconds, the curve will loop.

Of course you can plug anything in there, you can expose an attribute in the effect interface panel and use that to drive the emission directly.

Final note: Doing computations like these in the layergraph directly currently has some limitations if you put them inside templates (sub-graphs). You won't be able to wire a template input into part of the computation that you wire into a layer. This is something we intend to implement pretty soon.

Anyway, for what you're trying to do, it should be fine !

Hope this helps !


by Julien (35.3k points)
Thank you very much.
It is enough to solve my problem.