Live data from Hacker News

Simulating fluids, fire, and smoke in real-time

andrewkchan.dev

61–70 of 174 posts

Re: Simulating fluids, fire, and smoke in real-time

#61

They mention simulating fire and smoke for games, and doing fluid simulations on the GPU. Something I’ve never understood, if these effects are to run in a game, isn’t the GPU already busy? It seems like running a CFD problem and rendering at the same time is a lot. Can this stuff run on an iGPU while the dGPU is doing more rendering-related tasks? Or are iGPUs just too weak, better to fall all the way down to the CP…

> Something I’ve never understood, if these effects are to run in a game, isn’t the GPU already busy? Short answer: No, it's not "already busy". GPU's are so powerful now that you can do physics, fancy render passes, fluid sims, "Game AI" unit pathing, and more, at 100+ FPS. Long answer: You have a "frame budget" which is the amount of time between rendering the super fast "slide show" of frames at 60+ FPS. This give…

In theory it's perfectly possible to do all you describe in 8ms (i.e. VR render times). In reality we're

1. still far from properly utilizing modern graphics APIs as is. Some of the largest studios are close but knowledge is tight lipped in the industry.

2. even when those top studios can/do, they choose to focus more of the budget on higher render resolution over adding more logic or simulation. Makes for superficially better looking games to help sell.

3. and of course there are other expensive factors right now with more attention like Ray traced lighting which can only be optimized so much on current hardware.

I'd really love to see what the AA or maybe even indie market can do with such techniques one day. I don't have much faith that AAA studios will ever prioritize simulation.

Re: Simulating fluids, fire, and smoke in real-time

#62
post #48

As a person who did a PhD in CFD, I must admit I never encountered the vorticity confinement method and curl-noise turbulence. I guess you learn something new every day! Also, in industrial CFD, where the Reynolds numbers are higher you'd never want something like counteracting artificial dissipation of the numerical method by trying to applying noise. In fact, quite often people want artificial dissipation to stabil…

> Guess the requirements in computer graphics are more inclined towards making something that looks right instead of getting the physics right. The first rule of real-time computer graphics has essentially always been "Cheat as much as you can get away with (and usually, even if you can't)." Also, it doesn't even have to look right , it just has to look cool! =)

Why not cheat? I'm not looking for realism in games, I'm looking for escapism and to have fun.

Re: Simulating fluids, fire, and smoke in real-time

#65
post #32

Earlier quoted context omitted.

Same thing on a modern flagship smartphone.

Pixel 8 Pro here, using DDG browser, smooth for me.

What I can use works great on FF on my S22 Ultra, but it's not interactive because the shader fields won't register taps as click events.

Re: Simulating fluids, fire, and smoke in real-time

#66
post #4
post #2

it blows my mind that cfd is a thing we can do in real time on a pc

Yes, we can since a long time. They were already a thing 14 years ago on the PS3 in the game "Pixeljunk shooter" [0]. But real time simulations often use massive simplifications. They aim to look real, not to match exact solutions of the Navier-Stokes equations. [0] https://www.youtube.com/watch?v=qQkvlxLV6sI

thanks, i had no idea about pixeljunk shooter! it looks like those fluids are 2-d tho. otoh it's apparently performing a multiphysics simulation including thermodynamics

btw, almost unrelatedly, you have no idea how much i appreciate your exegesis of the voxelspace algorithm

Re: Simulating fluids, fire, and smoke in real-time

#67
post #48

Earlier quoted context omitted.

> Guess the requirements in computer graphics are more inclined towards making something that looks right instead of getting the physics right. The first rule of real-time computer graphics has essentially always been "Cheat as much as you can get away with (and usually, even if you can't)." Also, it doesn't even have to look right , it just has to look cool! =)

Why not cheat? I'm not looking for realism in games, I'm looking for escapism and to have fun.

I don't think this is a great argument because everybody is looking for some level of realism in games, but you may want less than many others. Without any, you'd have no intuitive behaviors and the controls would make no sense.

I'm not saying this just to be pedantic - my point is that some people do want some games to have very high levels of realism.

Re: Simulating fluids, fire, and smoke in real-time

#68
post #36

Does anyone have any recommendations for a former math major turned SWE to get into CFD simulations? I find this material fascinating but it's been a while since I've done any vector calculus or PDEs so my math is very rusty.

If you're more interested in the physics simulation for research, I can't help ya. However, SideFX Houdini is tough to beat if you're going more for entertainment-focused simulations.

https://www.youtube.com/watch?v=zxiqA8_CiC4

Their free non-commercial "Apprentice" version is only limited in its rendering and collaboration capabilities. It's pretty... uh... deep though. Coming from software and moving into this industry, the workflow for learning these sorts of tools is totally different. Lots of people say Houdini is more like an IDE than a 3D modelling program, and I agree in many ways. Rather than using the visual tools like in, say, blender, it's almost entirely based on creating a network of nodes, and modifying attributes and parameters. You can do most stuff in Python more cleanly than others like 3ds Max, though it won't compile, so the performance is bad in big sims. Their own C-like language, vex, is competent, and there's even a more granular version of their node system for the finer work with more complex math and such. It's almost entirely a data-oriented workflow on the technical side.

However, if you're a "learn by reading the docs" type, you're going to have to learn to love tutorials rather quickly. It's very, very different from any environment or paradigm I've worked with, and the community at large, while generally friendly, suffers from the curse of expertise big-time.

Re: Simulating fluids, fire, and smoke in real-time

#69
post #8

Page is basically unusable on my Intel MBP, and still a beastly consumer on my AS Mac. I presume simulations are happening somewhere on the page, but it would be a good idea to make them toggled. Ideally via user interaction, but if one insists on auto-play when scrolled into the viewport.

Runs fine in Ubuntu Linux using Firefox, but not in Google Chrome on my Lenovo Core i7-12700H 32GB laptop with Nvidia T600.

Re: Simulating fluids, fire, and smoke in real-time

#70

As a person who did a PhD in CFD, I must admit I never encountered the vorticity confinement method and curl-noise turbulence. I guess you learn something new every day! Also, in industrial CFD, where the Reynolds numbers are higher you'd never want something like counteracting artificial dissipation of the numerical method by trying to applying noise. In fact, quite often people want artificial dissipation to stabil…

Was the PhD worth it in your opinion?

Hard to say whether economically a PhD always makes sense, but it certainly can open doors that are otherwise firmly closed.
Post reply on HN