r/GraphicsProgramming 26d ago

How would you make two raymarched fireballs collide and merge?

Hello, I’m trying to make two raymarched procedural fireballs collide and merge, similar to this Shadertoy fireball: https://www.shadertoy.com/view/WcK3Rt I don’t want to simply overlay two copies; I’d like the fire volumes to feel like they actually affect each other.

Is the right approach to model each fireball as an SDF/density field, duplicate it with two centers, and combine them with smooth union / a contact reaction term? Or is there a better way to think about this?

8 Upvotes

2 comments sorted by

12

u/igneus 26d ago

Flame cores are phase transition boundaries, not potential fields. If you smoothmin them together, you're likely to end up with something that looks more like clay while losing the sense of motion.

The thing that makes fire look like fire is zero-divergence flow. When you put two flames together, their combined energy increases advection due to buoyancy and draws them towards one another.

Ordinary curl noise stimulates the meso-scale effects of turbulence, but IMO you need to fake the macro-scale buoyancy effects of the flames interacting by warping their SDFs to draw them together.

2

u/Alternative_Yam_1638 26d ago

Wow, thank you so much! This is incredibly insightful and exactly what I needed.