GSoC 2020: Soft Body Sim - Discussion and Suggestions

Work will be committed to the soc-2020-soft-body branch in the extern/softbody and intern/softbody directories if you want to check it out.

This thread is for discussion and suggestions related to the project.

9 Likes

A pin group equivalent from cloth sim would be nice, so you could exclude certain vertices from the sim.

4 Likes

In your weekly reports you wrote about using TetGen. I want to post some info here about its license (AGPL3).

TetGen license FAQ: TetGen Licensing FAQ

GNU’s article regarding license compatibility between the GPL and AGPL: Various Licenses and Comments about Them - GNU Project - Free Software Foundation

Please note that the GNU AGPL is not compatible with GPLv2

This is concerning to me. Blender is released under the GPLv2, and using AGPL licensed code might require an upgrade to GPLv3

I know that @Howard_Trickey did some work to add Constrained Delauney Triangulation to Blender. I don’t know what more you need for your project, though.

Hopefully it’s not a problem and you can just go with your current plan :smiley:

2 Likes

I added 2D Constrained Delaunay Triangulation, which I wrote myself from scratch. This would required a 3D version, which would need a rather different algorithm. If the TetGen license is a problem (and seems it might be), I suppose me or someone could write a 3d CDT.

5 Likes

Good catch, I appreciate you looking at that more closely. TetGen isn’t a necessity, and I wasn’t aware of the incompatibility between AGPL and GPLv2. I think in the end we do want some tetrahedralization, but it doesn’t have to be TetGen. My preferred tetrahedralization software is TetWild, which is MPL2 and some included GPL libraries (CGAL).

1 Like

Please bear in mind that I am not a lawyer. I think Dalai is the one to talk to about this sort of thing, since he is the project coordinator. Maybe Ton is the one to ask. Well, I guess your GSOC mentor is the first one to talk to!

Thanks for taking a second look. Even if your work is great, it won’t be accepted in master if it complicates the software licensing, and I really want to see improvements to the softbody simulation.

Question 14 on this page: https://www.mozilla.org/en-US/MPL/2.0/FAQ/
may be of help in regards to TetWild. I know that Blender incorporates Apache code (Cycles). TetWild’s readme says that it is MPL with some GPL code, so it is not dual-licensed. The requirement to “additionally distribute” the code under MPL is a little bit concerning, but doesn’t seem to be impossible to work with.

Well, take a look here: https://www.blender.org/about/license/
Maybe AGPL is OK, since this site says Blender binaries are distributed with GPL3. The Blender download has several different licenses included - GPL2, GPL3, Python’s License, jemalloc’s license (which is BSD derived). I know the Apache license is included in Cycle’s source code, not sure if it’s necesary to include in binary distributions (didn’t see it in the download)… this looks like “additionally distributed” under ___ license. Blender would have to make the TetWild library available as MPL code and GPL code.

Anyways, if AGPL code is available under the GPLv3, then I hope you can just move ahead with TetGen and not worry about any of this. At any rate, I think further investigation is warranted, and I hope the solution will not involve a lot of extra work.

2 Likes

Blender is effectively licensed under GPLv3. This is because we wanted to use some other GPLv2 incompatible libs and thus we moved to GPLv3.

So this should not be an issue at all. (Otherwise we would be illegally using other GPLv2 incompatible libs right now).

We do not change any licence on the libs we use. They keep their original licence and the libraries are simply stored in a “external libs” directory in the blender source code. These are then built as stand alone projects and linked to blender when building.

So in the case of TetWild, simply including it would not change anything and the code will be distributed and available as originally licensed.

6 Likes

Thank you for clearing that up! I’m so happy to be wrong!

1 Like

Hey Matt! :slight_smile:
I just read your weekly report and am quite frankly blown away by your speedy progress.
I thought that the little suzanne gif was already so cool just 3 weeks into GSoC!
After this weeks report I really wanna try out your branch!
Unfortunately I cant find a (windows) build of your branch, is there any yet?

Can I support you somehow, artistically?
I.e. demoscenes like: An animated arm with bones, muscles and skin?
Or anything else you would wanna test but would take too much of your valuable dev time? :wink:

2 Likes

Thanks! You can certainly try out the branch, but I’ll warn you there is no interface for solver options (yet). There’s not much to try out at this time, because a lot of constraints that would be used for animation (e.g. pins and goal positions) are not yet implemented. You won’t be able to do much besides add a mesh and drop it on stuff.

As for windows build, I’m not sure? Nothing I have committed so far is platform specific so it should compile on windows just fine. I am not super familiar with the build system.

Can I support you somehow, artistically?

Absolutely :slightly_smiling_face:. I appreciate the offer. An animated arm with bones/muscles/skin is exactly what I am looking for. Something like this but simplified and without any add-ons or deformation (e.g. the first minute of the video) would be helpful. Nothing fancy, just enough for me to test self collision and volume preservation, and try to get a production-ish mesh up to interactive rates. Is something like that possible?

2 Likes

Absolutely! I’d love to help! Give me a day or two to set something up that is both convenient to use and presentable! :slight_smile:

Good point regarding the pinning groups. So I should be patient and let you do your magic for a couple more weeks. :smiley:

I accidentally posted in the other thread that was your progress report (well, the post was on purpose, but it wasn’t the right spot.) :grin: So I’ll delete it there and post it here:

This is looking incredible. Keep up the great work and I’m working on a long term character animation project right now that I’m hoping to be able to use this on if it gets committed in the fall! This could, and I believe will be another major step forward in Blender character animation!

Hello, I get this error when I try to compile/build for Linux:

-- Configuring done
CMake Error at build_files/cmake/macros.cmake:260 (add_library):
  Cannot find source file:

    src/admmpd_bvh_traverse.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx
Call Stack (most recent call first):
  build_files/cmake/macros.cmake:352 (blender_add_lib__impl)
  extern/softbody/CMakeLists.txt:54 (blender_add_lib)


CMake Error at build_files/cmake/macros.cmake:260 (add_library):
  No SOURCES given to target: extern_admmpd
Call Stack (most recent call first):
  build_files/cmake/macros.cmake:352 (blender_add_lib__impl)
  extern/softbody/CMakeLists.txt:54 (blender_add_lib)


CMake Generate step failed.  Build files cannot be regenerated correctly.
make: *** [GNUmakefile:301: all] Error 1

Absolutely! I’d love to help! Give me a day or two to set something up that is both convenient to use and presentable! :slight_smile:

Awesome! No rush at all. I will not likely get a chance to look at it until mid next week, possibly later. And thanks, I’ve wanted an arm rig to play around with for a while.

This is looking incredible

Thanks!

Hello, I get this error when I try to compile/build for Linux:

Oops, my bad. Renamed some files and forgot to commit them. Should be good to go now.

3 Likes

Hey, @mattoverby I’ve been following this project for some weeks now and I really have to say that it seems really interesting, keep up the good work! I have some questions, but they can seem really dumb and confusing, so I apologize in advance. So here it goes:

I’ve built Blender from this branch, and I’m not sure if this is the right place to get the source code. Anyway, assuming I went to the right place, what do I have to do inside Blender to find your solver? I went to the physics tab and selected the soft body, but it looks like it is the same present in version 2.83. Is there anything I should activate inside Blender before going to the physics tab? Or do I have to specify something even before building Blender? I just did a “regular” build of blender using that branch I mentioned and the only thing I can see different from the 2.83 version is the Tet remesher, I can’t find anything related to your solvers.

Hope I wasn’t too confusing

Hi. I don’t know anything about technical issues and code. I wonder if the solver/code implemented here could be implemented in the future for Cloth Simulation (I mean if they are compatible, and in the future and not related to the work of this GSoC project).
Cloth Simulation in Blener has become old, and increasingly heavy and difficult to configure.

Oh neat, I did not know there was a gitlab page. That is indeed my branch, and my sim code is in extern/softbody. I am not sure about full build or lite build.

Since there has been a few questions about building and testing the code, it might be worthwhile for me to look into this more. Starting next week I’ll be tagging commits that are stable that way people don’t waste time trying to compile/run code that has unfinished parts.

For example, if you were to try it right now (commit c4484057) you’ll run into issues unless the constraint stiffness is way down (Gauss-Seidel not converging because the matrix is not diagonally-dominant). These things aren’t obvious.

A good question. Yes, it can be used as a cloth simulator. You can see the demos in the related papers for examples. The difficult part about cloth simulation is not the dynamics, though, it’s resolving self intersection. That would take a bit more work to get up and running in the ADMM-PD solver, if possible.

2 Likes

Thanks for the reply @mattoverby ! I edited that message because since then I actually got a full build working now, the problem is that I cant find the solver inside Blender

If you’re asking how to use the softbody solver, there isn’t anything special. You import a (closed) 3D surface mesh. Under the physics tab you click the “softbody” button. To add obstacles to collide with you add them to the scene, right-click join them into one object, then click the “collision” button in the physics tab. That’s all there is to it for now.

I’m really excited for this, the progress on it looks great. I haven’t tried to build it yet. I was wondering if I just want to simulate a character’s arm and have it react to the main body’s animation as well as collide with the body. Is that possible at the moment? If so how would you go about doing that.