Fire, smoke and sparks vfx using VFX Graph in Unity Unity 2021.3.10f1
- Random Velocity, Angle and Lifetime
- Flipbook Animation
- Face Camera Plane
- Size over Life
- Wind and Drag Forces
- Color Multiply and Color over Life
- Normal Maps
- Lighting
- Sparks Effect
-
Project configuration
- Use the High Definition Render Pipeline.
- Use VFX Graph.
-
Particles Randomness
- In the Initialize node of the VFX.
- Set initial velocity of particles to a random range.
- Set lifetime of particles to a random range.
- Set initial Z angle of particles to a random angle.
- In the Initialize node of the VFX.
-
Flipbook animation
- Replace default quad output node with a Lit Quad Output node.
- Use soft particles and set smoothness to zero.
- Set the material type to translucent.
- Set the color map texture to the sprite sheet with all the sprites for the smoke animation.
- Set the "UV mode" to FlipbookBlend and set the x and y size.
- In the Update node of the VFX.
- Add a flipbook player and set the framerate.
- Replace default quad output node with a Lit Quad Output node.
-
Face Camera
- in the Lit Quad Output node
- Add an "Orient" component to make particles face the camera always.
- in the Lit Quad Output node
-
Size over Life and Wind Forces
- in the Lit Quad Output node
- Add a size over life curve to make particles change size over.their life.
- in the Update node
- Add a relative force to make the smoke be affected by the wind.
- Add a linear drag using the particle size, to make particles have different drag during their lifetime.
- in the Lit Quad Output node
-
Color Multiply and Color over Life
- in the Lit Quad Output node
- Set "Use base color map" to just Alpha, to be able to fully control the color of the sprites.
- Set a gradient for the color over life, to make particles change color during their lifetime.
- Add a color parameter to multiply color, to be able to tint the whole smoke together.
- in the Lit Quad Output node
-
Normal Map and Lighting
- in the Lit Quad Output node
- Enable "Use Normal Map".
- Set the normal map.
- If the VFX has an unusual green tint, then you need to create a new diffussion profile asset and set it to the Lit Quad Output node.
- Add a point light at the bottom of the VFX to make the normal maps more noticeable.
- in the Lit Quad Output node
-
Sparks Effect
- Add a Swarm Particle System next to the main system in the VFX
- Turn down the defaul values to have just a few sparks.
- Adjust lifetime values.
- in the Initialize and Update nodes
- Copy paste the random initializations and forces from the nodes of the smoke, to have sparks mimic the same effects.
- in the Lit Quad Output node
- Set "Multiply Color" to make sparks glow.
- in the Update nodes
- Add a turbulance affected by a time node.
- Add a Swarm Particle System next to the main system in the VFX