Changing shader at runtime vs multi-purpose shader

I’ve been doing a course on shaders and I’m thinking of creating a death animation shader which puffs up the mesh and then explodes.

My question is: Is it better to do this using 1 shader on the model which handles everything. Or switching from 1 shader to my “Explode” shader just before the enemy dies?

I’m thinking that since the fatness parameter will be calculated every frame by the shader, it might hinder performance by having it applied to all enemies at all times.

Thanks in advance!

Generally, this depends on the platform. This is related to the question of the “Uber shader” (Google provides). On mobile devices, where the GPU is weaker, it is generally found that the demand of a larger shader is worse than switching shader programs. Conversely, on consoles and PC platforms, the switch of the shader program is relatively more costly than complex shaders. So, it depends on your primary target device type.