Working of Cloth Modifier

Cloth modifier when applied on 2 identical meshes with identical settings (same settings on UI) gives different results, the resulting meshes’ coordinates might differ at the last decimal or the first place decimal itself. I would like some help, I am trying to add unit tests for simulate modifiers.

Ideally that shouldn’t happen. Is the effect on the overal simulation that comparing them becomes impossible, or is there some reasonable threshold value that you could use to compare vertex positions?

The first suspect would be multithreading, you can try running with 1 thread (blender -t 1 and set environment variable OMP_NUM_THREADS=1) and see if it still happens then. The test could be run without multithreading, though it’s better if we can avoid having to do that. We do want simulations to give exactly the same results on different runs, so it’s something to be looked at.

If that doesn’t work, then finding the cause is probably more tedious narrowing down things, disabling features (like collision) or disabling code until you can pin down exactly where the result becomes different.

@brecht The results were same with single threading, so imo this is not the problem, the threshold value (in this case it is threshold_square) I reached is 0.05 (by hit and trial, it was failing at 0.01). The thresh value is a predefined macro (const) [ FLT_EPSILON ], so for testing should I send this as parameter? or is it not acceptable i.e. too large as compared to e-10 ( again thresh_sq)
Do you have any other ideas where the difference is coming ?