![[explosion-shader.gif]]
One of the visual challenges I ran into while developing _Crunch Element_ was getting explosions to feel right—both stylistically and technically. Explosions are a core part of the game experience, especially with all the breaching and destruction mechanics. But early on, the visual solutions I tried either didn’t fit the look of the game or weren’t performant enough for VR.
I ended up building a custom explosion shader with Shader Graph that plays nicely with a stylized, low-poly aesthetic and avoids the common pitfalls of transparency-heavy effects.
## The Problem
> As you can see, the old explosion effects leave much to be desired.
![[old-explosions.gif]]
The explosions I tried at first had clear issues:
- Emissive icospheres felt way too basic—there was no texture, no directionality, just a glowing blob.
- Realistic sprite-sheet explosions looked completely out of place next to the game’s low-poly assets.
- Transparent particles worked visually but were expensive to render, especially during chaotic scenes with multiple explosions happening at once.
My goal was to create something that:
1. Matched the game’s stylized aesthetic,
2. Was performant in VR,
3. And clearly communicated the origin and force of the explosion.
## The Solution
I ended up with a solution that uses a custom shader applied to simple 3D meshes. The key feature is a **directional blend** between an emissive flame core that fades outward into smoke based on the particle’s distance from the explosion origin.
![[single-explosion.gif]]
### 1. **Directional Blending from Emissive to Smoke**
When an explosion spawns, I pass the explosion’s origin position into the shader via a C# script. The shader uses that position to calculate how far each fragment is from the source, and then blends from bright emissive fireball near the center to dark smoke toward the edges.
The result is a radial gradient that feels like the explosion is expanding outward, cooling as it goes. It's subtle, but it adds a lot of visual direction and impact without needing to animate anything manually.
### 2. **Low-Poly Mesh Explosions**
Instead of using billboarded particles, I modeled a few low-poly explosion meshes. They’re just slightly more complex than a sphere—enough to give visual shape and catch light in interesting ways.
These meshes have more presence in a VR environment and feel like part of the world instead of floating visual noise.
### 3. **Shared Noise Textures**
I reused the same noise textures that I use in common reflective materials. It keeps everything visually consistent and helps the explosions feel integrated into the world.
### 4. **Dithered Fade-Out**
To handle the fade-out phase, I used a simple dithering technique. It’s basically a noise-based alpha clip that slowly ramps up, so the explosion disappears in a way that feels deliberate and avoids using expensive transparency.
This also has the added benefit of leaning into a sort of retro-futurist feel, which works well with _Crunch Element’s_ art direction.
The **explosion lifetime** is intentionally short. It complements the longer-lived destruction system (fractured walls, impact decals, etc.), so I don't have to worry about lingering particles.
### 5. **Custom Vertex Streams**
To support multiple explosions with different timings, I use Unity’s custom vertex streams to pass per-particle data into the shader—specifically, fireball progress and fade progress. This way, each explosion can evolve independently, even if they share the same material.
## Comparison to Earlier Attempts
Here’s how this approach stacks up against previous versions I tried:
| Approach | Outcome |
| -------------------------- | ----------------------------------------------------------------------- |
| Emissive Spheres | Too simple. No sense of motion or direction. |
| Sprite-Sheet Explosion | Visually inconsistent with the rest of the game. |
| Tiny Cartoon Particles | Lacked force. Too playful. |
| Transparency-Based Effects | Looked good but hurt performance. |
| **Custom Shader (Final)** | Stylized, directional, efficient. Fits the visual language of the game. |
## Final Thoughts
![[cluster-shot.gif]]
This shader came out of a need to balance style, clarity, and performance. I wanted an effect that communicated energy and force without overloading the GPU or looking out of place in a low-poly world.
This is my go-to explosion effect for most gameplay moments: grenade blasts, breach charges, scripted explosions. It’s fast, consistent, and easy to tweak.
Having the explosion effects intentionally short also allows for offloading detail to contextual events such as the material of the destructible objects being destroyed, where more detailed and material-specific effects are layered in.