0 like 0 dislike
75 views
I am using v2beta3 and a newbie to popcornFX and little intimidated by how low level this system is.

I am trying to create a simple ring emitter: Particles spawn randomly in a circle.

I am trying to do this with the available nodes and not relying on script.

I am sure I am missing something simple, any help is appreciated.
by sloanx007 (150 points)

1 Answer

0 like 0 dislike
 
Best answer

Hi.

So I just lost everything I typed, thanks answerhub.

So yes the system can be pretty low level if you need. It's mainly oriented towards templates (subgraphs) to avoid having to dig too low level too often.

Currently in the beta we haven't yet released an extensive library of helper templates, so you still have to do many things "by hand".

The good thing is if you find yourself doing the same operations over and over, you can create your own templates and reuse them in your effects :)

So, to spawn on a ring, you can use various approaches:

1- Use a shape

  • Right-click in an empty space in the graph, start typing "shape", it should select the "shape" node, hit enter, it'll drop it in the graph.
  • Drag a wire out of the output pin, drop it in an empty space, the node creation popup should appear, start typing "sample shape", it should select the "shape sampler" template, hit enter.
  • Drag a wire out of the "position" output pin, type "xform" in the node creation popup, validate. This will transform the local position to world, as renderers expect positions to be in worldspace. You'll need this to use the effect in the game engine, otherwise it'll appear at the world origin.
  • Wire the output of the xform node into your renderer.
  • Setup the shape to sample a "Cylinder", of height "0", in "Surface" mode. This will sample the outer surface of the cylinder (it doesn't sample the caps), with a height of 0, so it'll give a circle.

(Note: you can also setup the shape to sample in "Volume" mode, and set "InnerRadius" to the same value as "Radius", this will also sample a circle)

2- Use arithmetic nodes

Instead of using a shape, you can do the computations directly, by computing a random angle, wiring it into a "sin" node and a "cos" node, then wiring both of these into a "construct float3" node. This will give you a random position on a circle. You can then wire this into an xform and render node, like with the first method:

Note: all the angles are in radians, this is something that's pretty unpleasant to work with, and we might switch to degrees before the january 2019 release to make it more convenient. But currently it's all in radians. So here the rand between 0 and 6.2839 (2*pi) is in fact a rand between 0 and 360 degrees.

3- Create a template

You can select the various nodes that make your "function", and hit Ctrl+G.

This will pop a dialog asking you to name a new template. Here I named it "Sample Ring"

The template will be created in the second section of the effect treeview:

By selecting it here, you can change some of its properties, and make it public so you can access it from other effects. (the "Class Type" dropdown just changes the color code of the template when you use it inside graphs)

You'll notice that currently the editor does a pretty bad job at automatically naming the inputs & outputs of the template, so you'll most likely need to change them by hand.

Notice I didn't select the "radius" constant node, so it automatically added it as an input to the new template.

If you go in the newly created template (double-click on it inside the graph), you'll see two "export" nodes, that take care of "exporting" the single input and single output value this "Spawn on Ring" template has:

By selecting those two nodes you can change a whole bunch of stuff (including the exported names), say the input 'float' value is a slider, etc...

You will need to change the "Exported Type" of the input to be explicitly a 'float' value (not auto), to be able to control min/max values and whether or not it's shown as a slider.

There'd be a lot of stuff to cover regarding how to create and setup templates, but anyway, you get the idea :)
Also, there quite a lot of significant improvements on that side coming soon in beta-4 !

4- Ring emitter event template

There is one last method which is creating an event template to make a "ring emitter", like the event multiplier node, but which pulses out events laid out along a ring.

This is more advanced, and would require an actual tutorial to cover, but this will be one of multiple "placement" templates we'll provide.

I can cover this in greater details if you're interested in tackling it.

Hope this helps !!

And don't hesitate to post feedback / bugreports / requests on the beta-test support tracker.
We don't update the user-reported tickets very often but it helps a lot :)

Thanks,

by Julien (32.6k points)
Holy cow! Thanks so much! I will take some time to look this over. I had a solution that was starting to develop so I will be interested to see how it compares to your solutions here.
...