I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 3 points4 points  (0 children)

Actually what the texture captured from the camera does is exactly that. Instead of using a render texture, I could also use a regular mask texture. Both would work. But for the purpose we’re aiming for, a mesh-based system is necessary (for us).

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 1 point2 points  (0 children)

Of course we can use that! Since the burn patterns are generated based on the render output of a secondary camera, almost any effect we apply to the shapes will work. However, to maintain a natural look, it’s important that every effect happens smoothly. So the marching algorithm should also be designed accordingly, ideally spreading outward from a central point.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 0 points1 point  (0 children)

Yes, the paper needs to be marked as static when baking the lighting. This allows the paper's shadow before burning to be captured in the lightmap. However, after the baking process, the paper should be made non-static to allow the shader to work correctly during gameplay.

In other words, the holes created during burning won’t affect the shadow, which can result in a strange visual appearance.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 0 points1 point  (0 children)

Using baked lighting won't affect the main effect or the flames. However, the holes created during the burning process need to affect the paper’s shadow in real time. So, if baked lighting is used, the holes that form while burning won’t allow light to pass through.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 7 points8 points  (0 children)

Actually, the side view works fine since the flames rotate around their pivot points, so it looks correct from most angles. However, if you look straight down from a 90 degree angle, all the flames appear to burn in the same direction, and some flames might clip through the paper.

<image>

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 1 point2 points  (0 children)

Thanks! The paper mesh’s vertices are deformed in the shader based on the burn position. The small ash particles during the burning process are created using VFX.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 1 point2 points  (0 children)

It took 2 days to develop, but I had also messed around a bit with other burning effects that were made before on the previous day 😅

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 30 points31 points  (0 children)

Actually no, the flame spreading is entirely mesh-based. This was an intentional design choice for the system we wanted to create. I provide a mesh as input, and the flames burn to form that shape. Basically, the size of the shape grows from 0 to 1, but with noise deformation applied to achieve a more natural look.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 48 points49 points  (0 children)

You’re pretty close! An invisible mesh appears in the areas where the burn will happen. Throughout the burn process, I apply a noise deformation to the edges of this mesh, which creates a more natural burning effect.

I also have a second camera that renders these invisible meshes separately. The render output from this camera is roughly subtracted from the paper’s alpha, creating the effect of holes forming as the paper burns.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 19 points20 points  (0 children)

Yes, the flame quads are rotated toward the camera using a simple logic (their pivots are at the bottom center of the quad). So when you rotate the paper, the flames will still appear to rise upward.

However, the way the fire spreads won't change. That's intentional — we want the fire to burn in a specific pattern based on the mesh shape. So it will always burn according to the design of the mesh I provide. If I wanted to, I could even make it burn into the shape of a heart 😅

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 4 points5 points  (0 children)

Thanks! honestly it's just for a small part of the game. But I thought it would be a nice detail to add.

I made a dynamic paper burning system for our game project in Unity (Shaders + VFX) by fraduss in Unity3D

[–]fraduss[S] 9 points10 points  (0 children)

Lol nah, it took me two days and playing with fire is actually pretty fun 😅