0
$\begingroup$

I am working on cloth simulation with blender through python,

Mainly 2 phases, first, I wrap clothes around a static human body model and apply cloth modifier, then, I add the cloth modifier again and simulate while the body moves,

the first phase creates certain deformations on the cloth that later affect the results of the simulation,

Is it possible to change the rest length and bending angle of the spring mass model? So that my clothes do not show any kind of bias to certain shapes

$\endgroup$

1 Answer 1

1
$\begingroup$

So, I have been trying to do this on my own by modifying Blender source code,

in the file 'source/blender/physics/intern/BPH_mass_spring.cpp', in the function 'BPH_cloth_solve', just after it gets the reference to the Cloth object (line 1080), I manually set the rest angle of every spring to 0.0f,

this seems to do the trick w.r.t. bending, problem now is the rest length,

I'd like to be able to define a vertex group that shall have uniform spring rest length, I think this could be achieved by adding an additional flag to ClothVertex class (source/blender/blenkernel/BKE_cloth.h, line 96), and changing the ClothModifier so I can add an additional field with a vertex group (and maybe a checkbox to activate this behaviour), then, I think I should set this vertex flag at 'source/blender/blenkernel/intern/cloth.c', function 'cloth_apply_vgroup' (line 650), this should allow me to have access to which springs belong to this vertex group, so in the same part of the code I set rest angle to 0.0f, I can compute an average spring length for those springs and set it as rest length,

nevertheless, I am a little lost on how I can change the Cloth Modifier so that I can include an additional field with a vertex group, so that it later becomes a field of the object ClothModifierData on 'cloth.c',

if anyone has a better picture of how blender source code works and can share thoughts on this I'd be very thankful,

I'll keep trying to figure it out by myself, and if I see reponses from other people that have the same problem, I can share whatever solution I finally come up with

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .