Categories
Personal work Unity

Burning planks in Unity

I built a prefab emitter that spits out planks in Unity using C#.

While I created the effect I built the scene at the same time. I created this scene (maybe a little too complex for real-world workflow) with some control parameters because I like to work on interactive objects.

Providing a simple context like this saves a lot of time for me when iterating on the effect. I think the result turns out better too. Setting up a scene like this also allows me to think about potential implementation features the effect could benefit from.

Plank Projectile

Plank projectile is simple geometry with convex collision. Randomly selecting between six different plank meshes on creation. Plank variations are roughly sized 0.5-1 meter long.

Flame sprites that use plank mesh as geometry emitter. Particles are simulated in localspace to make plank look on fire.

Smoke emission is distance based together with standard emission rate so it still emit smoke when static on land.

Additive Smoke lit up by the flame is using an Additive shader with the same texture as smoke but with shorter lifespan.

Embers are sprites with noise applied to their motion.

Ground impact

When the plank hits the ground it will spawn an impact VFX. The impact VFX is oriented with its impact normal. The impact share a few elements as the plank fire – Smoke, Additive Smoke and Embers.

After plank has come to a stop, it will stop burning after a few seconds. The extinguish sequence is not really animated or designed, it just disables emission of particles. If taking this effect further, I think that the way it fades out is important as well.

Water impact

Directional elements are driven by the impact direction of the projectile, I named this property tilt in this project. With a steep impact-angle the splash should appear less directional while flatter impact-angles should result in a more directional splash. The impact “directionality” is handled in code to tilt only a few select elements of the water impact effect.

Ripples & Foam consist of expanding rings on the water. Secondary ripples appear in splash direction as water splash fall down on water.

Fire is extinguished and result is a small Smoke puff and Embers.

For the water splash, I used two different textures, one is more misty and is suited well for bigger elements while the second texture is used for smaller elements such as droplets.

After a short delay, there is a secondary and smaller splash of water simulating the plank impact creates a small air-pocket which then collapse into the secondary splash. This effect is super obvious when looking at reference videos for objects dropped into water.

Basic water droplets add a little more detail.

What can bring this effect further?

  • Scalable effects based on per-plank variables (attributes or parameters), for example:
    • Size of plank affect fire-amount.
    • Fire-amount variation to give each plank thrown a more unique look.
    • Impact should scale based on size of plank and impact speed.
  • Better water surface shader
    • Transparent, underwater fog & vertex animated.
    • Vertex animated water surface would break my effect currently as I use horizontal billboards for a flat static water surface.
    • Water surface transparency would also break the effect, as water splash particles are currently rendered underwater.
  • Bubbles underwater from the plank when the fire fizzles out.
  • Refraction on the water splash.
  • Heat haze distortion from fire.
  • Improved particle lighting & shading
    • Support time of day.
    • Smoke should react better to dynamic lights.
    • Improved backlighting (when looking through particles towards the sun).
  • Burning wood-shader on plank.
  • Adding wind to particle motion.
  • Ripples from plank when it’s floating.
  • Smaller textures by using less frames in flipbooks.
  • Cull underwater particles.
  • I like the water-splash a little better when I set timescale to 1.3, so I think this element could have benefited from a little extra tweaking to its timing.
  • Screen effect that adds a water splash to camera lens if close enough.
  • Audio!