Skip to content

Fire, smoke and sparks vfx using VFX Graph in Unity URP.

Notifications You must be signed in to change notification settings

z4gon/fire-vfx-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fire VFX

Fire, smoke and sparks vfx using VFX Graph in Unity Unity 2021.3.10f1

Reference Tutorial

Features

Screenshots

Multi Colors Screenshot 1


Random Velocity, Angle and Lifetime

Fire VFX by Brackeys

Randomness

Flipbook Animation

Flipbook Animation

Face Camera Plane

Face Camera Plane

Size over Life, Wind and Drag Forces

Size over Life, Wind and Drag Forces

Color Multiply and Color over Life

Color Multiply and Color over Life


Normal Maps

Without Normal Maps

Without Normal Maps

With Normal Maps

With Normal Maps


Fire/Smoke VFX Graph

Spawn and Initialize Update Output


Lighting

Lighting

Sparks

Sparks


Sparks VFX Graph

Spawn and Initialize Update Output


Implementation explained

  1. Project configuration

    1. Use the High Definition Render Pipeline.
    2. Use VFX Graph.
  2. Particles Randomness

    1. In the Initialize node of the VFX.
      1. Set initial velocity of particles to a random range.
      2. Set lifetime of particles to a random range.
      3. Set initial Z angle of particles to a random angle.
  3. Flipbook animation

    1. Replace default quad output node with a Lit Quad Output node.
      1. Use soft particles and set smoothness to zero.
      2. Set the material type to translucent.
      3. Set the color map texture to the sprite sheet with all the sprites for the smoke animation.
      4. Set the "UV mode" to FlipbookBlend and set the x and y size.
    2. In the Update node of the VFX.
      1. Add a flipbook player and set the framerate.
  4. Face Camera

    1. in the Lit Quad Output node
      1. Add an "Orient" component to make particles face the camera always.
  5. Size over Life and Wind Forces

    1. in the Lit Quad Output node
      1. Add a size over life curve to make particles change size over.their life.
    2. in the Update node
      1. Add a relative force to make the smoke be affected by the wind.
      2. Add a linear drag using the particle size, to make particles have different drag during their lifetime.
  6. Color Multiply and Color over Life

    1. in the Lit Quad Output node
      1. Set "Use base color map" to just Alpha, to be able to fully control the color of the sprites.
      2. Set a gradient for the color over life, to make particles change color during their lifetime.
      3. Add a color parameter to multiply color, to be able to tint the whole smoke together.
  7. Normal Map and Lighting

    1. in the Lit Quad Output node
      1. Enable "Use Normal Map".
      2. Set the normal map.
      3. 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.
    2. Add a point light at the bottom of the VFX to make the normal maps more noticeable.
  8. Sparks Effect

    1. Add a Swarm Particle System next to the main system in the VFX
      1. Turn down the defaul values to have just a few sparks.
      2. Adjust lifetime values.
    2. in the Initialize and Update nodes
      1. Copy paste the random initializations and forces from the nodes of the smoke, to have sparks mimic the same effects.
    3. in the Lit Quad Output node
      1. Set "Multiply Color" to make sparks glow.
    4. in the Update nodes
      1. Add a turbulance affected by a time node.

About

Fire, smoke and sparks vfx using VFX Graph in Unity URP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages