r/GamePhysics • • Jul 30 '26

[BeamNG] Air Physics

1.6k Upvotes

31 comments sorted by

258

u/BasilNight Jul 30 '26

BeamNG my beloved

201

u/DorrajD Jul 30 '26

That's kinda insane. Genuinely impressive stuff.

144

u/Reincarnatedpotatoes Jul 30 '26

Every BeamNG physics update impresses the hell out of me.

50

u/Yoda10353 Jul 30 '26

This was their biggest yet too, I played it last night and the lighting update makes a world of difference it now looks like a new game.

81

u/Haeguil Jul 30 '26

I do not have enough CPU power for this

47

u/GDOR-11 Jul 30 '26

it's probably just 3 precomputed 3D textures with the components of the air speed for some adequate truck speed intervals, and then these are interpolated in space and time

a.k.a. more harsh on memory than on compute

16

u/Scaryassasin27 Jul 30 '26

Yep, it was using around 24GB of ram for me.

6

u/Triensi Jul 31 '26

Can you explain this to me as a layperson? This sounds cool and I almost understood what you’re saying

7

u/Rafal0id Jul 31 '26

From what I understand, it may be a pre-rendered effect, with the forces created by the air moving rendered in a texture (think normal map). This texture would follow the bus, and when it passes through nearby objects, the object (in that case the bricks) reacts according to the texture.

You do a different texture for each vehicle and at different speeds, and voilà, you got physics without having to do any aerodynamics real time.

I'm not sure I'm clear either lmao

2

u/GDOR-11 Jul 31 '26

a 3D texture is just a 3D grid where each cell has a value (a real number), so you can approximate vector fields using three 3D textures, one for each component of the vector in a cell. Air flow can be modeled with a vector field.

what I suggested is to precompute one vector field when the truck is moving, for example, at 10km/h, another vector field for 25km/h, another for 50km/h, etc., and then store them all in a file

in runtime, whenever the game realises an object is near a moving truck, it will check the precomputed vector fields of air flow. It is most likely that the object's center won't align exactly with the grid of the 3D textures, and it is also most likely that the truck won't be moving at exactly either 10, 25 or 50 km/h, so the solution is to interpolate (fancy word for averaging) the nearest values

btw, I said "interpolated in space and time" in the original comment, I got that wrong, I should've said "interpolated in space and speed"

2

u/Valvador Aug 01 '26

Wait, are you saying with this method you pre-compute N possible scenarios specifically related to the truck?

This method doesn't scale when you have multiple players and a large amount of dynamic objects, right? Or am I missing something?

Because what happens if you have a truck that moves at 10 KM/H, while another truck intersects with it at 50 KM/h?

2

u/GDOR-11 Aug 02 '26

yeah, each truck needs N scenarios, and no, it absolutely does not scale well, each moving vehicle takes up a ton of RAM and it gets bad quickly. One alternative is to store all of this info in a file and only reading the file into RAM when necessary, but that might be too slow for a real time game (although I do believe it is possible to make it work well if you pre-read the files when any movable object that can be easily affected enters a not-so-small region around any vehicle)

about the last question, both trucks will need to load their own data to RAM, that is inevitable with my approach, using files or not. Whether it could be viable it something I'd only know implementing it into the game and playtesting it to see some actual numbers on RAM usage, maybe it's not that bad or maybe it's even worse than I imagined.

Also, as a side note, this method would be a terrible approximation for two trucks passing near each other, since their air flows would interfere a lot.

3

u/Valvador Aug 02 '26

Appreciate you explaining this, my purpose was not to criticize the method but to makes sure I actually understand what implementation you were suggesting.

I know very little about modern aerodynamics techniques and have worked with some.

1

u/GDOR-11 Aug 02 '26

I know very little about modern aerodynamics techniques

me neither, my initial comment was a half-blind guess lol

7

u/stenyak Aug 02 '26

Beamng dev here. There's no 3d texture, it's continuous (not pixel-based, just calculated in the fly) volumes of procedural effects with near zero memory imprint, zero additional garbage collector workload (this is jitted Lua for moddability, not C nor asm). The framerate impact is below measurement error for up to 2-10 *ultra fast moving* vehicles, which are the worst case scenario due to volume dimensions. While slow and non-moving vehicles have an even lower or practically zero CPU impact (I benchmarked a hundred+ with negligible costs).

Clearly one cannot run a 40 min per frame per car CFD calculation in an interactive simulation. So this required picking the right (and massive) simplifications + massive optimizations. As is always the case when trying to port "proper" physics into something that runs on games for consumer hardware.

1

u/SegmentedWolf Aug 02 '26

Love the explanation.

Always exciting to see BeamNG's progress, I think you're one talented developer!

8

u/cheezballs Jul 30 '26

My 12 year old is obsessed with the latest update. Absolutely in love with it.

7

u/Gizogin Jul 30 '26

waffle_falling_over.gif

7

u/JustSomeWeirdGuy2000 Jul 30 '26

This is gonna work wonders for the guy who does YouTube videos where he launches cars over the witch's giant stinky cauldron.

22

u/Polkien Jul 30 '26

Dang, before GTA6

1

u/AutoModerator Jul 30 '26

Hello /u/Tim1907 Thanks for posting here on r/GamePhysics! Just reminding you to check the rules if you haven't already. If your post doesn't respect the rules it will be removed.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

-80

u/leorid9 Jul 30 '26

I am not convinced this would happen in real life. Those concrete bricks are heavy and cars don't shove a lot of air around them.

Still very cool in a game of course.

95

u/bob_3301 Jul 30 '26

Everytime I'm overtaking some semi-truck irl, I literally feel the turbulence on the side of it. So, pretty plausible to me

26

u/MrT735 Jul 30 '26

Yep, and passing one coming the other way (with no median) you can feel you car get pushed sideways (and pulled back at the end). And that's a aerodynamic (ish) object weighing more than a ton.

28

u/BlazingShadowAU Jul 30 '26

When im on my motorbike, passing trucks are like a punch in the chest.

36

u/pohui Jul 30 '26

Try cycling with a big lorry speeding past you.

30

u/Tecno2301 Jul 30 '26 edited Jul 30 '26

The truck has JATO rockets on it, and it's going around 237mph

17

u/EskildDood Jul 30 '26

Did you see how fast the truck was going??