0 like 0 dislike
61 views
Hi ,

I'm using the V1.12 editor for Iclone.

Is there a way to apply an animated texture on a mesh emited ?

I know it's possible on billboard but I would like to make a sphere shield with animated texture.

Thank you
by mtakerkart (260 points)

2 Answers

0 like 0 dislike

Hi,

Unfortunately you can't do this in the v1 PopcornFX editor.

One (nasty) solution would be to use multiple mesh descriptors of the same sphere mesh, but with different textures, and use MeshID to switch between each one of them.

For example, using an evolve script to update the MeshID:

   float repeatCount = 4; // animation loops 4 times across the life of the particle
   float meshCount = 10; // 10 frames of animation, 10 textures, 10 mesh descriptors
   MeshId = frac(LifeRatio * repeatCount) * meshCount;

You can create a new mesh renderer, click on the "Mesh_Descriptor" node in the treeview, set it up with the proper material and first texture then hit Ctrl+D to duplicate it, setup the copy to use the 2nd texture, etc...

Emulating the "SoftAnimationBlending" feature

The above script will produce a hard switch between textures, and the different frames of animation will seem to "pop".

You can work around this but it'll be more complicated, you will have to use two mesh renderers, each with the same set of multiple descriptors, and cross-fade between them.

Make sure your mesh is setup to "Additive", then duplicate the entire mesh renderer.

Change the new mesh renderer to use "MeshId2" instead of "MeshId".

Add a new float4 "Color" and "Color2" particle field.
Select all descriptors of the first mesh renderers using shift+click or ctrl+click to edit them all in one go, then in the "MaterialParametersFields" array, add a new property "DiffuseColor = Color" for the descriptors of the first mesh, and "DiffuseColor = Color2" for the descriptors of the second mesh.

Then change your evolve script to look like this:

    float repeatCount = 4; // animation loops 4 times across the life of the particle
    float meshCount = 10; // 10 frames of animation, 10 textures, 10 mesh descriptors

    float animId = frac(LifeRatio * repeatCount) * meshCount;
    float lerpCursor = frac(animId);
    MeshId = floor(animId);
    MeshId2 = select(MeshId+1, 0, MeshId >= meshCount-1);
    Color = float4(1, 1, 1, 1-lerpCursor);
    Color2 = float4(1, 1, 1, lerpCursor);

The setup should look something like this:

And give a result like this:

(Here it's just cycling through various unrelated textures, using the above crossfading example script)

This is a pretty horrible way to work around it, and you'll need one physical texture per animation frame, you won't be able to use an atlas.

But it should work.

by Julien (35.2k points)
0 like 0 dislike
Thank you for your reply . You're effect is very good but very complicated for my knowledge of popcorn. I'm not a coder. I find a way to nearly approche what I want deriving the "ElectricalBall_pCoords" template. But if you can share or sell your effect it'll be welcome to make animated mesh .

https://i.postimg.cc/7PVTFrCN/Shield.gif
by mtakerkart (260 points)
...