I wrote a super simple flame simulation a long time ago as a toy in C after reading an article somewhere. You just set each pixel’s brightness to be the average brightness of the immediately adjacent pixels. Calculate from bottom to top. Add a few “hot” pixels moving back and forth along the bottom and boom, instant fire. Looks very cool for a tiny amount of code and no calculus. :)
Could you share the repo?
Simulating fluids, fire, and smoke in real-time
141–150 of 174 posts
Re: Simulating fluids, fire, and smoke in real-time
#142I wrote a super simple flame simulation a long time ago as a toy in C after reading an article somewhere. You just set each pixel’s brightness to be the average brightness of the immediately adjacent pixels. Calculate from bottom to top. Add a few “hot” pixels moving back and forth along the bottom and boom, instant fire. Looks very cool for a tiny amount of code and no calculus. :)
This is the laplacian operator (in 1D, just the second derivative, or curvature). The sharper the crest, the more negative; the sharper the trough, the more positive. If you change the value there, by that much, the effect is averaging (and the discretized form is literally averaging). You've been doing calculus the whole time. There's a difference between knowing the path, and walking the path. Here's a 3Blue1Brown…
Re: Simulating fluids, fire, and smoke in real-time
#143Earlier quoted context omitted.
My favorite example of the lie-concealed-within-the-lie is the ‘Half-Life Alyx Bottles’ thing. Like, watch this video: https://www.youtube.com/watch?v=9XWxsJKpYYI This is a whole story about how the liquids in the bottles ‘isn’t really there’ and how it’s not a ‘real physics simulation’ - all just completely ignoring that none of this is real . There is a sense in which the bottles in half-life Alyx are ‘fake’ - that…
I want to see that shader. How is sloshing implemented? Is the volume of the bottle computed on every frame? Clearly, there's some sort of a physics simulation going on there, preserving the volume, some momentum, and taking gravity into account. That the result is being rendered over the shader pipeline rather than the triangle one doesn't make it any more or less "real" than the rest of the game. It's a lie only if…
Re: Simulating fluids, fire, and smoke in real-time
#144Earlier quoted context omitted.
Welp. It used to be PhysX math would run on a dedicated gpu of choice. I remember assigning or realising this during the Red Faction game with forever destructing walls. Almost Minecraft, but with rocket launchers on mars
I'm fairly certain red faction didn't use Nvidia physX at all.
Re: Simulating fluids, fire, and smoke in real-time
#145Earlier quoted context omitted.
Maybe you're not the right person to ask, but I'll go anyway: I would like to learn the basics of CFD not because I expect to do much CFD in life, but because I believe the stuff I would have to learn in order to be able to understand CFD are very useful in other domains. The problem is my analysis is very weak. My knowledge about linear algebra, differential equations, numerical methods, and so on is approximately l…
You'll be able to understand the equations I guess. The hard part is the numerical analysis: how do you prove your computations will: 1/ reach a solution (badly managed computations will diverge and never reach any solution) 2/ reach a solution that is close to reality ? For me that's the hard part (which I still don't get). You could start with Saint Venant equations, although they look complicated they're actually…
With respect to 2, the standard industry practice is a mesh convergence study and comparing your solver's output to experimental data. Sadly, especially with Reynolds-averaged Navier Stokes, there is no guarantee you'll get a physically correct solution.
Re: Simulating fluids, fire, and smoke in real-time
#146Earlier quoted context omitted.
Not being a graphics person, is this what hardware ray tracing is, or is that something different?
Rayteacing doesn't simulate light, it simulates a very primitive idea of light. There's no diffraction, no interference patterns. You can't simulate the double-slit experiment in a game engine, unless you explicitly program it. Our universe has a surprising amount of detail. We can't even simulate the simplest molecular interactions fully. Even a collision of two hydrogen atoms is too hard - time resolution and space…
Re: Simulating fluids, fire, and smoke in real-time
#147Earlier quoted context omitted.
Well, sure. Everything you end up doing in life will open doors that would have otherwise remained firmly closed if you did something else instead.
"Everything you end up doing in life will open doors that would have otherwise remained firmly closed" Oh no. It is also quite possible to do things, that will very firmly close doors, that were open before, or making sure some doors will never open .. (quite some doors are also not worth going through)
Re: Simulating fluids, fire, and smoke in real-time
#148Earlier quoted context omitted.
If I understood Feynman’s QED at all, light gets quite simple once you get close enough to the surface. ;) Isn’t the idea was that everything’s a mirror? It sounds like all the complexity comes entirely from all the surface variation - a cracked or ground up mirror is still a mirror at a smaller scale but has a complex aggregate behavior at a larger scale. Brian Green’s string theory talks also send the same message,…
Sure, light gets quite simple as long as you can evaluate path integrals that integrate over the literally infinite possible paths that each contributing photon could possibly take! Also, light may be simple but light interaction with electrons (ie. matter) is a very different story!
Re: Simulating fluids, fire, and smoke in real-time
#149Earlier quoted context omitted.
Sure, light gets quite simple as long as you can evaluate path integrals that integrate over the literally infinite possible paths that each contributing photon could possibly take! Also, light may be simple but light interaction with electrons (ie. matter) is a very different story!
Don't the different phases from all the random path more or less cancel out , and significant additions of phases only come from paths near the "classical" path? I wonder if this reduction would still be tractable on gpus to simulate diffraction
I just googled and there’s a ton of different papers on doing diffraction in the last 20 years, more that I expected. I watched a talk on this particular one last year: https://ssteinberg.xyz/2023/03/27/rtplt/
Re: Simulating fluids, fire, and smoke in real-time
#150Earlier quoted context omitted.
This was the big realization for me when I got into graphics - everything on the screen is a lie, and the gestalt is an even bigger lie. It feels similar to how I would imagine it feels to be a well-informed illusionist - the fun isn’t spoiled for me when seeing how the sausage is made - I just appreciate it on more levels.
My favorite example of the lie-concealed-within-the-lie is the ‘Half-Life Alyx Bottles’ thing. Like, watch this video: https://www.youtube.com/watch?v=9XWxsJKpYYI This is a whole story about how the liquids in the bottles ‘isn’t really there’ and how it’s not a ‘real physics simulation’ - all just completely ignoring that none of this is real . There is a sense in which the bottles in half-life Alyx are ‘fake’ - that…