0 like 0 dislike
100 views

Hello everybody.

I used "CParticleRenderer Mesh" to make a circumferentially spreading ring. I want to let the tail of particles further from this ring.

but, it is not "CParticleSamplerShape",

I can not get particles from the surface of the mesh. Is there any way?

Specs:
· PopcornFX: 1.11.3

※ This article uses the Google translation.
  I'm sorry in strange English.

by 4696itatsi (180 points)
Hi,

CParticleRenderer_Mesh is a renderer, and as the name implies only handles the rendering part of the particle. If you want to spawn particles on a mesh shape you will need to use the CParticleSamplerShape like you pointed out. If you need some helps creating a specific effect feel free to send us your FX at support at popcornfx dot com so we can help you with that.

1 Answer

0 like 0 dislike

Hi,

As Hugo said in his comment, you can't sample a renderer.

I assume you have two layers:

  1. a layer that spawns a single particle that has a mesh renderer with the ring mesh, the particle changes its size over time, which makes the mesh ring appear to grow and spread across the life of the particle.
  2. a layer that spawns many particles, which you'd like to match the expanding mesh of the first layer

Is that correct?

If it is, you'll need to do the following in the second layer:

  1. Create a shape sampler mesh in the second layer, and reference the same mesh you have in the renderer of the first layer.
  2. Setup the second layer duration to the life of the particle of the 1st layer. If the mesh particle lives 3 seconds, set the 2nd layer duration to 3 seconds as well
  3. In the spawn script of the 2nd layer particles, reproduce the Size transform of the first layer, using 'spawner.LifeRatio' instead of 'LifeRatio' in the first layer.
  4. sample the mesh sampler in the spawn script, then multiply that position by the Size computed earlier and that should make the second layer's particles match the expanding mesh of the first layer.

Here is a concrete example with scripts:

Layer 1:

properties:
    Duration : 0.0 seconds
    SpawnCount : 1

spawn script:
    function void Eval()
    {
        Life = 3.0;
    }

evolve script:
    function void Eval()
    {
        Size = pow(LifeRatio, 0.5) * 3.456; // whatever size computation
    }

Layer 2:

properties:
    Duration : 3.0 seconds
    SpawnCount : 100 // whatever

spawn script:
    function void Eval()
    {
        Life = 1.0; 
// whatever
        float scale = pow(LifeRatio, 0.5) * 3.456; // must match layer 1
        Position = scale * ShapeSampler.samplePosition();

    }

In red, the life/duration values that must match.
In purple, the size/scale computations that must match.

Hope this helps,
Cheers

by Julien (32.8k points)
...