Why CParticleEvolver_Projection no weight?

0 like 0 dislike
i want let pacticles   fly from the ground to the A_MESH Surface,and finally fly to the B_MESH Surface,but i find the CParticleEvolver_Projection no weight ~~!,Could you tell me what can i do it??Thankyou : )!
asked Jun 13 by pjwaixingren (190 points)

1 Answer

0 like 0 dislike


the projection evolver will instantly snap the particle positions on the mesh surface, it cannot interpolate.

to interpolate, you will have to sample a position on A_MESH, and sample another position on B_Mesh (or use a projection from the position on A_Mesh onto B_Mesh to find a coherent position on B_Mesh), then use a lerp() between the two positions to make a smooth transition.

For example:

particle fields:
float3 PosStart;
float3 PosEnd;

In spawn script:
PosStart = A_MESH.samplePosition();
PosEnd = B_MESH.samplePosition();

In evolve script:
Position = lerp(PosStart, PosEnd, LifeRatio);

More interesting movement in evolve script using a turbulence sampler named "Turbulence":
float3 posLinear = lerp(PosStart, PosEnd, LifeRatio);
float displacementFade = 1 - pow(abs(LifeRatio*2-1),2);
float3 posDisplacement = Turbulence.sample(posLinear) * displacementFade;
Position = posLinear + posDisplacement;

Another way to construct PosStart and PosEnd:
float3 PosStart = A_MESH.samplePosition();
float3 posStartInSpaceOfB = PosStart - A_MESH.position() + B_MESH.position();
float3 PosEnd = posStartInSpaceOf
B + B_MESH.project(posStartInSpaceOfB).xyz;

Hope this helps !

answered Jun 14 by Julien (30,860 points)
Thank you:)!