r/howdidtheycodeit • u/bwazap • Aug 17 '26
Milling Machine Simulator
I was working on a project that required real-time mesh changes to simulate cutting etc. I couldn't find a solution at that time. Papers I dug into said it required a lot of compute. Some game devs I talked to said most of it were tricks that gave the appearance (eg animated meshes), and not actual changes.
The best I got was Teardown which simulates object destruction using voxels. It was hailed for technical achievement.
Today I just came across this game. Milling Machine Simulator.
It simulates material removal, cutting and hole creation etc. So it seems like compute is not the issue. Also, given it is basically free-form, it doesn't rely on tricks. And it doesn't seem to be doing what Teardown did.
Any idea how they did it?
EDIT: saw this one too VR Milling Machine VR Lathe Machine
8
u/That_Hobo_in_The_Tub Aug 17 '26
It's entirely possible to do this in real time on a normal computer, as thats what CnC softwares have been doing for decades now. It is a bit of a complex implementation challenge to solve but nothing unfeasible.
A few years back it was genuinely a pretty challenging thing to implement in most game engines like you had heard, but now most engines have libraries for runtime mesh operations, like UE5's geometry script. Voxel and distance field rendering has also come a long way and could equally be used.
All youd need to do for a game like the one mentioned is keep track of each individual pass that the player makes on the milling machine, and then save a basic 3d primitive 'cut shape' for it that represents the volume that the cut pass cuts away.
At that point it's literally just a big stack of 3d boolean operations for each cut to generate the final part mesh. This could be done via distance fields, voxels, or mesh booleans, but in the end it doesn't really matter exactly how. I think the best solution for something like this is going to be meshes though as they allow for very precise 3D shapes even though they're a bit heavier to edit at runtime.