Muscle system for blender

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Muscle system for blender

Post by handydan » Mon Nov 19, 2007 4:57 pm

I'm planning on implementing a muscle system in blender which I've designed from scratch. It uses a modified Gaussian function along with user data to calculate deformations. The way I'm thinking of putting it in is to add an object type "Muscle" which can be edited with the edit panel in the buttons window type. Eventually I want to be able to add modifiers to muscles so that the muscle can be deformed by armatures etc.

I've finished the maths side of it all and I can program "fluently" in c/c++, but I'm new to the blender source and I don't know where anything is. Basically to begin with I just need to know how to add in a new object type.

Dan

LetterRip
Posts: 1462
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Thu Nov 22, 2007 7:30 am

Hi handydan,

very neat sounding idea,

instead of another object type - you might want to consider adding muscle as a modifier to mesh instead similar to how softbody is done.

That said, here is a tutorial on how to add an object type

http://wiki.blender.org/index.php/BlenderDev/ObjectType

and here is info on the modifier stack

http://wiki.blender.org/index.php/Blend ... ementation

LetterRip

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Thu Nov 22, 2007 4:52 pm

I thought about a muscle modifier for a mesh, but I decided against it because I thought it may make it difficult to use. Instead I decided on having an object containing only muscles which can be modified by armatures and then to deform a mesh with muscles there will be a modifier for the mesh which takes as parameters the muscle object and density of skin.

Dan

p.s. how difficult would it be to get this included in the next blender release, if it all works.

Caronte
Posts: 521
Joined: Wed Oct 16, 2002 12:53 am
Location: Valencia-Spain-Europe

Post by Caronte » Thu Nov 22, 2007 5:40 pm

handydan wrote:...I decided on having an object containing only muscles which can be modified by armatures and then to deform a mesh with muscles there will be a modifier for the mesh which takes as parameters the muscle object and density of skin.
WoW! :shock: :shock: :shock:
Caronte.
"Some Day, All Will Be Digital"
http://www.nicodigital.com

LetterRip
Posts: 1462
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Thu Nov 22, 2007 8:44 pm

If it works well and is coded 'reasonably' getting stuff into head isn't usually too difficult if something is useful. You might email bf-committers with a design doc and letting everyone know what you are up to. Of course sometimes it is a lot easier to get something working, provide a patch, and then ask for feedback.

LetterRip

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Sat Nov 24, 2007 10:25 am

The Object type tutorial in the wiki has got errors in it. It misses out some include files and some of the code could cause memory leaks if it worked. Where should I get write access for the wiki from to correct it?

Dan

jesterKing
Site Admin
Posts: 1848
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Sat Nov 24, 2007 3:00 pm

Tell me what your wiki username is, and I can give you write access.

/Nathan

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Sat Nov 24, 2007 5:53 pm

Its Handydan

jesterKing
Site Admin
Posts: 1848
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Sun Nov 25, 2007 10:57 am

handydan wrote:Its Handydan
Done.

/Nathan

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Sun Nov 25, 2007 1:33 pm

thanks

bendansie
Posts: 1
Joined: Thu Nov 29, 2007 1:43 pm

Post by bendansie » Thu Nov 29, 2007 1:48 pm

hey handydan. I was just about to try a cheat method for muscles using the new mesh deform modifier, but your way sounds much better. If you want any help testing or with models/characters/animation etc then I'm all ears. I mainly hang around the blenderartists.org forums under the same user name. I can't help with code however because I dont know any and by the time I learnt enough you'll probably have finished.

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Sat Dec 01, 2007 10:49 am

thanks, but I'm still a ways off making anything usable yet.

I've got a problem with a memory leak. The problem is that my object isn't being freed when blender shuts. To my understanding free_libblock in Blenkernel/intern/library.c is the function that should free the object, but it isn't being called for my object.

I think that the problem is that my muscle object isn't being added to the current scene. After looking at the Scene struct I found the linked list "base". Is this where objects are stored in the scene? and if so where and how in the source should my object be added to the list?

The next problem will probably be, how to add an edit mode to my object and also how to alter the buttons panel to add editing options, but after that I think I can finish it.

any help much appreciated,

Dan

handydan
Posts: 35
Joined: Mon Nov 19, 2007 4:40 pm

Post by handydan » Sun Dec 02, 2007 5:35 pm

I'm really stumped by this, I've been closely following the lattice object, but searching the source for "case OB_LATTICE:" doesn't throw up anything as far as I can see, (but I did find out where to add the buttons panel code).

anybody got any ideas?

Dan

p,s I added "printf("freeing %s\n", id->name);" to the top of free_libblock. Its definitely not being called for my object.

jesterKing
Site Admin
Posts: 1848
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Sun Dec 02, 2007 6:10 pm

A place to quickly get answers is #blendercoders at chat.freenode.org. Please do join us there :) I'm sure you'll find the most help there.

/Nathan

hoxolotl
Posts: 20
Joined: Wed Jun 11, 2003 5:55 pm
Location: Netherlands
Contact:

Post by hoxolotl » Wed Dec 05, 2007 3:52 pm

Sorry, maybe it's already in the code (but as I don't speak gaussian deformations I wouldn't know). The thing that would really be great with having a "muscle mesh" would be to make it so that the collisions with a softbody are "correct". I've been trying out to get a muscle (fluid) inside a membrane (softbody) but the two systems being separeted at baking, it didn't get very far.
From observation I noticed that the volume of the muscle is constant, and thus that a fluid inside a softbody would nicely simulate it.
The real trick would be to have the skin over the muscle "riple over" to get realistic anatomic rendering.
Disclaimer: I'm not asking for anything, I'm just airing my thoughts.

Have fun coding.
I can make it fast, good, and cheap, pick any TWO of those.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests