0 like 0 dislike


I need to hide my particles as they go out of a certain bounding area.

Specifically I want them to move along the surface of a mesh and only be visible for certain parts of that mesh (but carry on existing as they travel along the 'hidden' parts of the mesh surface).

I can think of a couple of ways of doing this, but I think the feature from UE4's cascade to use a Custom Occlusion Bounds  is what I need.

Is there a similar feature for the PKFX UE4 plugin ? Or another way of doing this? Basically occluding parts of the particle system depending on its position in world space.

I hope you can help


asked by Sean (270 points)

1 Answer

1 like 0 dislike
Hi Sean,

A simple way to do that would be to set particle size/scale to 0 when you want to hide them. They'll continue existing but won't render. You can use shape samplers to check if your particle is inside/outside a specific (see Shape.contains() https://wiki.popcornfx.com/index.php/Scripting_reference_1130#Samplers). This will give you the control you need.

You can expose shapes as Attribute samplers so they can be overriden in UE4 and directly placed in your UE4 level.

In UE4, we don't have Cascade's equivalent of Custom Occlusion Bounds per effect/layer. You can however specify on the PopcornFXSceneActor hard bounds (change the Bounds from Dynamic to Fixed). Keep in mind this will affect all particles rendered in that scene.

answered by HugoPKFX (15.8k points)
Thanks again Hugo for the answer :)

That makes sense but when I'm doing it it doesn't work.

In a simple test in the Effect Editor (1.13) I am creating a layer which spawns particles within a random volume. I have created a Shape Sampler, set its type to Mesh and selected my mesh. The mesh volume does intersect with the particles as they evolve. I have created an evolver script and placed the following code in it:  

function void    Eval()
    float3 particlePos = Position;
    int frag1 = Teapot.contains(particlePos);
    Size = 0.009 * frag1;

with Teapot being the shape sampler name.

I assumed this would select the particle's current position and check if it intersects with the teapot shape (sometimes it would and sometimes it wouldn't in my test setup) and then set its scale depending on the output from contains()

The result from Teapot.contains(particlePos); is always 0 so my effect dissapears completely.

I have tried setting the SampleDimensionality on my shape/mesh to both Surface and Volume but neither work.

Any idea what I'm doing wrong here?

Hi Sean,

Looking into this you are right it doesn't seem to work with meshes samplers. However you should be able to have this working correctly with simple primitives (box/sphere/capsule/..).

Can this be enough for your effect ?

We'll look into implementing this missing feature in future PopcornFX versions
Yes Hugo, I think I can achieve my effect anyway using a different method :)

At some point the custom mesh sampling would be quite cool I can think of various  ways that could be used so awesome if it is implemented at some point.

Thanks for your help on this