Intro
Hello fellow artists!
I have embarked on the journey of learning VFX art since some months now. During these times I have created a lot of different shaders that i then used to make some of my effects. As the time went on, I started to spot more and more similarities between the different shaders. A few days ago, I have converged on a single shader that has allowed me to create this explosion effect.
Together with the kit, I have included a number of meshes with different types of UV unwrapping and pivots, which allowed me to create the different particle systems with the same spatial shader.
The shader
This master shader works for a variety of different particle types, from fully 3D particles with heightmaps and meshes, to billboard flipbooks. Most parameters are not meant to be used all together, for example panning the texture over the particle life doesn’t make much sense if particle animation is enabled.
Textures
This shader supports two separate textures for particles and different ways of mixing them. Additionally, the textures can be made to pan on different directions in the UV space.
mix modemix strategy for the textures. 0 means multiply, 1 means add.texture1first color texturetexture1 offsetoffset for the first texturetexture1 scalescale for the first texturetexture1 pan directiondirection in which the first texture should pan, in UV spacetexture1 pan speedspeed of the panning for the first texturetexture2second color texturetexture2 offsetoffset for the second texturetexture2 scalescale for the second texturetexture2 pan directiondirection in which the second texture should pan, in UV spacetexture2 pan speedspeed of the panning for the second texture
In the following image, from left to right
- Two textures, one panning, one static acting as a mask. Mix mode 0
- Same textures as the previous one, but with mix mode 1
- Two different panning textures, mix mode 0
- Two different panning textures, mix mode 1

Emission
One of the biggest features that I missed in the spatial material was the ability to animate the emission value over the life of the particle. The shader introduces two parameters to control emission.
emission energy: the overall emission energy of the particlesemission over life: a curve that describes how the emission behaves over the lifetime of the particle.

Alpha control
Fading alpha is cool but have you heard of alpha erosion?
There are multiple ways of doing it, and I tried to include the most common in the shader.
The behaviour of the shader is different depending wheter or not you have enabled the alpha erosion property, which is on by default.
The behaviour of the alpha is driven by the COLOR variable, which is assigned through the process shader with either a single color, or using a color gradient texture.
alphais the main alpha value of the shader to which another value is subtracted (or multiplied whenalpha erosion is off. The particle cannot get more opaque thanalphadissolve textureis the texture used as a mask to dissolve the particles. Won’t work well if the particle is animated.erosion smoothnessdefines the value used later in the smoothstep. Should be 1 ifalpha erosionisn’u used to avoid strange behaviour
From left to right, alpha erosion with low smoothness, alpha erossion with high smoothness, no alpha erosion.

Proximity fade
Proximity fade is used to avoid quads visibly clipping with opaque geometry in the scene.
use proximity fadeenable proximity fadeproximity fade distancedistance in world space to the object before the fading starts
Camera fade
Sometimes particles can look rather nasty if they are too close to the camera. Camera fade causes the particle to fade out when too close to the camera.
camera fadeenable fading based on camera distancedistance fade mincloses point where the particle is still marginally visibledistance fade maxdistance above which the particle will be fully visible
Height amount
For effects such as smoke and other non-quad particles, sometimes a height map is required.
use heightmapenable height and normalmapheight textureheightmap of the particlenormal texturenormal map of the particle
Billboarding and rotation
The term “billboard” is used to refer to objects that always face the camera. In this shader it is a float instead of a boolean, so that the particle can be not billboard, full billboard, and a bit inbetween.
particle billboard blendwhen set to 0, the particle rotation is fully substituted with the billboard rotationrotate yworkaround to rotate_y being hard to control in the process shader.
Particle animation
While there are very cool effects based on dissolve maps, sometimes they just don’t cut it (wink wink). These settings enable the usage of flipbook style animation.
use particle animationenables the particle animationparticle anim h framesthe number of horizontal frames in the flipbookparticle anim v framesthe numger of vertical frames in the flipbookparticles anim loopshould the particle animation loopparticle animation resizeshould the mesh be divided on the xy axis by the number of h and v frames.
On the left, a flipbook with particle animation resize enabled.
On the right it is disabled, note the stretch of the image.
