Live data from Hacker News

Ten Minute Physics

matthias-research.github.io

21–30 of 43 posts

Re: Ten Minute Physics

#21

Ten Minute Physics is a great resource! Matthias Mueller makes concise demos and explains them really well. (Though I think it would take someone without existing familiarity with the subject matter a lot longer than 10 minutes to digest the results. Lots of rewatching!) A really interesting results that's come out of Matthias and co.'s research in the last few years that is still percolating its way through the real…

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

GPUs can definitely handle more than 700 entities. Here's 100k in a web browser: http://david.li/fluid/

But even most offline rendered fluid simulations are not that convincing to my eyes, let alone real time ones. It will be a long, long time before we have truly realistic behavior of real time water in unconstrained settings for games.

Re: Ten Minute Physics

#22
post #18

Earlier quoted context omitted.

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

> At this point, there are now other non-CPU bottlenecks. Any method of drawing 700 entities, even basic wireframe?, even with a very high end GPU on a nearly 20 year old game, is significant, and there's no easy way for me to break past this. I've run into this before - it _can_ be fast if your engine supports some form of mesh instances and exposes it to the user.

Would it be slow still if it recalculates everything?

Re: Ten Minute Physics

#23

Earlier quoted context omitted.

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

GPUs can definitely handle more than 700 entities. Here's 100k in a web browser: http://david.li/fluid/ But even most offline rendered fluid simulations are not that convincing to my eyes, let alone real time ones. It will be a long, long time before we have truly realistic behavior of real time water in unconstrained settings for games.

Have you seen RealFlow? I was having fun with their fluid physics simulator a few years ago, it's really good.

https://realflow.com/

Re: Ten Minute Physics

#24
post #23

Earlier quoted context omitted.

GPUs can definitely handle more than 700 entities. Here's 100k in a web browser: http://david.li/fluid/ But even most offline rendered fluid simulations are not that convincing to my eyes, let alone real time ones. It will be a long, long time before we have truly realistic behavior of real time water in unconstrained settings for games.

Have you seen RealFlow? I was having fun with their fluid physics simulator a few years ago, it's really good. https://realflow.com/

It looks cool, but I find that there's a characteristic "blobby" look to these simulations, especially visible in mostly flat parts or whenever thin sheets of liquid form and break apart. I imagine that increased resolution can mitigate it but the cost eventually becomes prohibitive even for offline simulation so people settle for "good enough". And I think foam/bubbles are usually kind of hacky (when present at all) rather than being simulated in a principled way.

Re: Ten Minute Physics

#25

Earlier quoted context omitted.

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

GPUs can definitely handle more than 700 entities. Here's 100k in a web browser: http://david.li/fluid/ But even most offline rendered fluid simulations are not that convincing to my eyes, let alone real time ones. It will be a long, long time before we have truly realistic behavior of real time water in unconstrained settings for games.

Yeah, it must be something specific about the overhead in the Source engine when drawing entities, but it doesn't matter if I render the particles as 2D sprites or as 3D models, both of them have a similar performance impact over not rendering them at all when there's 700, and there's no way it's a hardware limitation.

The GP shared some links below from other indie devs, there is a realtime water simulation that looks pretty dang good, though it looks to be on the scale of a human-sized tub.

Re: Ten Minute Physics

#26
post #22
post #18

Earlier quoted context omitted.

> At this point, there are now other non-CPU bottlenecks. Any method of drawing 700 entities, even basic wireframe?, even with a very high end GPU on a nearly 20 year old game, is significant, and there's no easy way for me to break past this. I've run into this before - it _can_ be fast if your engine supports some form of mesh instances and exposes it to the user.

Would it be slow still if it recalculates everything?

If what recalculates what?

Re: Ten Minute Physics

#27
post #15

Earlier quoted context omitted.

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

The problem sounds like you're doing O(N^2) calculations at every tick because each particle has to interact with every other particle. To make it faster you should keep some spatial datastructure so that you can query the other particles within a certain range of your current particle and just interact with those, ignoring the rest. The usual implementation is an octree or something similar. That said, N=100 should…

For particles of uniform size, a simple uniform grid will work best. If you set the grid cell size to the particle diameter, then you only need to search the adjacent voxels for each particle. The uniform grid method is also easy to port to the GPU, unlike other acceleration structures like BVHs or Octrees.

Re: Ten Minute Physics

#28
If you want to play with a little demo I made for talking about laser cooling physics go to:

https://zerok.com/demo/

Admittedly it will be a bit hard to follow without the accoupling lecture, but if you zoom in and press the buttons (cool, compress, etc...) it looks cool at least!

(it only performs well in chrome-derived browsers)

Re: Ten Minute Physics

#29
post #15

Earlier quoted context omitted.

This is very coincidental timing. The physics simulation in the Source game engine, and Garry's mod, absolutely cemented in me an interest in computational physics. I really wanted to see fully simulated fluid water in games, particularly GMod, but it never really happened, 15 years ago. This never stopped bothering me, so I recently loaded up the game and programmed an entity that was simply a particle that repelled…

The problem sounds like you're doing O(N^2) calculations at every tick because each particle has to interact with every other particle. To make it faster you should keep some spatial datastructure so that you can query the other particles within a certain range of your current particle and just interact with those, ignoring the rest. The usual implementation is an octree or something similar. That said, N=100 should…

I do have a parameter so that each particle only takes into consideration other particles within 750 units, when the free space is 3000x3000x3000 units, but this parameter did not seem too critical, and it's still calculating the distance between each pair twice technically, so I guess I could speed that up. Vector/"table?" operations seemed slower than plain loops, not sure if there's plain interpreter speedup possible there?
Post reply on HN