pixijs / particle-emitter

A particle system for PixiJS

Home Page:http://pixijs.io/particle-emitter/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best practice for continuous trail on a fast-moving object?

reececomo opened this issue Β· comments

Hey there πŸ‘‹

-I've got a fast-moving object (a ball)

  • I'd like to draw a continuous trail behind it.
  • Is that possible through particle-emitter? Attaching a standard emitter doesn't look great.

Is there a way to emit based on distance traveled, instead of once-per-draw-at-the-current-position?

Would the best alternative be drawing it manually using PIXI.Graphics?

Example

(Excuse the bad MS Paint.)

particles

The top image is roughly

In ^this specific example, there's actually two emitters, but same applies for one emitter.

For reference, just increasing emission rate results in patchy trails like this:

image

(While also adding some performance overhead on mobile)

Update: I think the gaps was caused by using a third-party interpolation renderer library (for smoothing 30Hz/120Hz/144Hz/etc.). I've wrapped Emitter so that Emitter.setOwnerPos() is triggered on the corresponding draw frames to the interpolated location and it looks considerably better now.

Still not great, a little patchy, looks ok when playing realtime, but still noticable in stills/screenshots:

gameplay snap

Another quick update: Performance is pretty horrendous on lower and middle-end devices, its only about ~2000 particles. Still investigating.

You can reduce the impact of this library on performance by using a LinkedListContainer (from this library) as the parent to your emitted particles. Basic particle emission will never get you a true trail, though, as that is typically a different mesh-based effect.

Tinkering around with thicker particles and not changing the scale, just the alpha - got the number of particles down from ~2300 to around 500 which has improved performance for now.

as that is typically a different mesh-based effect.

Ah thank you, that's probably a good place for me to look.

You can reduce the impact of this library on performance by using a LinkedListContainer

Nice, will have a look at that too.

image