I'm working with particles and little bit with shader. Both of them can do the same task like creating effects of flame, snow, glowing ...
So which one is better and what are differences between them?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityThis will depend a lot on the specific effect you're trying to achieve.
As one example, here's a pair of fire effects created by Edward del Villar. The one on the left uses particles, while the one on the right is a LineRenderer with a custom shader:
Because the version on the right is rendering on a continuous ribbon of geometry provided by the LineRenderer, it's able to bend and swish fluidly, while the particle solution visibly breaks up in motion, revealing the individual cards that make it up.
A particle system can be made more fluid/continuous by increasing the number of particles, but this can quickly eat into the fillrate available for the frame (drawing & blending over the same pixel multiple times instead of only once). This is especially concerning on mobile devices, so if you can make a shader that gives a similar effect in just one pass, it will often be faster (as long as the shader itself isn't too heavy)
But, the discrete particles also make it easier to make a chunky/cartoony stylized look to the flames, or create complex motion like swirling vortices and turbulence or sparks bouncing off walls. So if those aspects are important to your game's visual direction, particles could be a better choice.
Like everything in game development, there are many ways to achieve an effect, so with enough time investment we could probably give more fluid motion to the particle version, or more chunky art direction or complex animation to the shader version. More often than not, it will come down to which style makes it easier to get the effect you want quickly & reliably, since there are so many other features to work on. ;)
Finally, it's important to remember that these two tools aren't mutually exclusive, and you can often make spectacular effects by rendering custom shaders on particles themselves, on accompanying geometry, or in post-process effects on top of the particles, to compliment and enhance the visuals.
Check out this presentation on VFX used in Infamous Second Son for lots of inspirations for how shaders and particles can act in concert for beautiful results.