aframe-particleplayer-component icon indicating copy to clipboard operation
aframe-particleplayer-component copied to clipboard

Add property animation and randomization capabilities

Open feiss opened this issue 7 years ago • 3 comments

like randomScale, randomRotation factors, or "scale up to 3x along the animation", "fade out"..

feiss avatar Aug 23 '18 10:08 feiss

Animating individual properties like opacity over time is something that it is very useful and much required. However, I still didn't find which api and way would be the best to do it.

The problem with changing the opacity of particles individually right now is that we would have to create a single material for each particle, and that would destroy the performance. A gpu shader solution is needed for that. A workaround would be to create a single material per Particle System, but then all smoke particles of each particle system would fade out at the same time.

Both options, individual materials per particle or per particle system, need to animate the material.opacity in the tick() method. You have the relTime variable which goes from 0 to 1 in the life of the particle system.

Definitively it only will be possible in a proper way when the component uses gpu shaders. But I don't have an estimated date for that.

feiss avatar Aug 31 '18 08:08 feiss

You can use the animation component probably; it can animate arbitrary properties. Once it's in core, you can use it without dependencies and abstract the API more.

ngokevin avatar Sep 04 '18 20:09 ngokevin

well, the problem is not about how to animate, that can be easily done in one line. Is more a problem of performance and material optimization.. maybe I could add a simple opacity fadein/out property to the schema to animate the opacity of a particle system, as a quick and simple workaround.

feiss avatar Sep 04 '18 22:09 feiss