After the FLIP fluid sim I thought I’d give cloth sim a try using geometry nodes:
EDIT: added air resistance:
EDIT2: the air resistance drag force is supposed to face opposite from the velocity, but I feel I get more realistic results if I make it face along the normal away from velocity. What do you think?
I tried to use the general principles behind XPBD (substeps, constraints, velocity recalculation from position), but I have to admit I made a lot of the constraint handling up .
Right now I’m using the arctan2 of z&y for up and down weights, and the arctan2 of x&y for left and right weights. That still leaves out an axis. Does anyone have a better idea how to do this? X and Y work well for planar 2D meshes, but not so well in 3D. I tried using UV coordinates, but they’re very dependent on painstakingly proper UV unwrapping.
I ended up just adding another pair of directions (front and back) using arctan2 of X & Z, and in the distance constraint I now use 3 set position nodes instead of 2. Works pretty well. I’m sure there must be a smarter way of doing this though. Edited the original post with the updated images and blend file.
I tried using numpy (and cupy) to write a sim but gave up because I couldn’t figure out how to use blender’s baking and caching system with the python api.
These simulations are really something a gpu would bring big improvements on the current system for.
I assume you’ve seen mattias muller’s awesome videos on physics sims?
Awesome is the right word. They’re my reference for any physics based simulations.
I haven’t done much work with the blender python api, despite using python for a lot of other things (mainly data analysis and neural networks). You raise an interesting issue, though. We’ve always taken caching/baking for granted when we use geometry nodes, but in python you’d have to handle it yourself. I took a quick look at the docs and this seems to be the class to use. Is this what you tried?
I had a go but didn’t get anything working. it was probably over a year ago now so I don’t remember well. I know I managed to get a chain moving by using the manual screen refresh workaround