How to combine Custom Effect and Spritesheet Animation in Particle System?

Hi! I am working on a particle system and I have successfully gotten a custom effect working (GLSL fragment shader) as well as spritesheet animation.

However, when I turn both these features on spritesheet animation stops working:

How can I use a custom effect (GLSL fragment shader) and still have access to the correct UVs for my particle system’s spritesheet animation?

Ack, should have searched a little harder, when combining spritesheet animation and custom effects you need to add some more code (wasn’t mentioned in docs):

    let defines = [];
    ps.fillDefines(defines, ps.blendMode);
    let effect = engine.createEffectForParticles("myParticle", [], [], defines.join('\n'), null, null, null, ps);
    ps.setCustomEffect(effect);

Here is the fixed sanbox:

2 Likes