Female Figure/Topology Study (Nudity)

Help Please!

I’m trying to set up the shoulders with pydrivers, but my python knowledge is virtually non-existent. I’m using Jorge Rochas scipt, which I have as my pydrivers.py text. When I try and use a python expression such as:

p.z_comp('Humerus_L')/10

as my pydriver expression, the console gives me the following error:

Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “pydrivers.py”, line 72, in z_comp
File “pydrivers.py”, line 41, in lock_roll
NameError: global name ‘Mathutils’ is not defined
Is Mathutils not being imported correctly or what? Sorry for my total ignorance on the issue.:o

EDIT: Fixed it, the opening lines of the script are missing a line to import Mathutils. It should read:

import Blender
from Blender import Mathutils
from Blender.Mathutils import CrossVecs, Matrix, Vector 

The second line was missing. Should I tell the guy about it? I don’t know enough to really be able to correct him on the matter, but that got it to work for me.

Pretty sure that is the same script I’ve used before and from memory - he hasn’t looked at it for quite some time as the script was originally written (and updated here and there) for a few versions ago in Blender. Contact him if you like, I found him quite approachable the few times I’ve contacted him about that script and similar things.

So it’s probably not so much of a correction as it is a Blender version thing.

More people search / google these threads than you might think, (like me for nearly 2 years before being a member…) so for future reference, if you post the full updated version of the script in this thread, it will most likely become the new version all round for people searching how to do shoulders in Blender.

One more thought for now (nice progress btw) is that the inner mouth could use some more work. Teeth look fine, but the gums are a bit simplistic and she doesn’t have a throat that I can see. If you don’t plan to have her do much other than smile, you’ll be fine with that though. I thought I had a tutorial somewhere, but can’t find it.

Here’s the full updated script then, for any confused googlers, which should work with 2.48, only one line is changed from Jorge Rocha’s version, but it might save someone having to reinvent the wheel:

import Blender
from Blender import Mathutils
from Blender.Mathutils import CrossVecs, Matrix, Vector

def mtx_inv(mtx):
        mtxi= Matrix(mtx)
        mtxi.invert()
        return mtxi

# Return a rotation relative to a bone's parent
# bone. Works for constrained bones.
# The Y value is not the roll angle.
def loctrans(bone):
    ob = Blender.Object.Get('Armature')
    pose = ob.getPose()
    posebone = pose.bones[bone]
    restbone = ob.data.bones[bone]

    rest_matrix = restbone.matrix['ARMATURESPACE']
    rest_matrix *= mtx_inv(restbone.parent.matrix['ARMATURESPACE'])

    mtx = (rest_matrix * posebone.parent.poseMatrix).rotationPart()

    #Pose of bone in armature space
    pose_matrix = posebone.poseMatrix.rotationPart()
    # Pose bone in its own local space.
    return pose_matrix * mtx_inv(mtx)

def lock_roll(matrix):
        # Return a matrix with roll locked as if only
        # rotations around X and Z were possible.

        # Vectors of axes X and Z in the bone's local space.
    z_axis = Vector(0, 0, 1)
    x_axis = Vector(1, 0, 0)

        # Vector along the posed bone's Y axis.
    y = matrix[1]

    # The cross product of the bone's Y and axis Z makes a new
    # X vector lying exactly on plane XY of local space.
    x1 = Mathutils.CrossVecs(y, z_axis).normalize()

    # But the previous result cannot be used when the bone rotates
    # so it is exactly on its rest Z or -Z axes, a sudden twisting
    # occurs.
    # In that case axis X can be used as reference.
    z2 = Mathutils.CrossVecs(x_axis, y).normalize()
    x2 = Mathutils.CrossVecs(y, z2)

    # As a compromise to lock roll as much as possible, a blending
    # of vectors will ensure that no sudden twisting occurs when
    # reaching 90 degrees of rotation on either X or Z.

    # For a pydriver this result is close enough to what the IK solver
    # used as "track to" gives:

    f = abs(y.z) # Projection on z
    x = (x2 * (1-f) + x1 * f).normalize()
    z = Mathutils.CrossVecs(x, y)

        return Matrix(x,y,z)

def x_comp(bone):
        return lock_roll(loctrans(bone)).toEuler()[0]

def roll_angle(bone):
        matrix = loctrans(bone)
        noroll = lock_roll(matrix)
        return (matrix * mtx_inv(noroll)).toEuler()[1]

def z_comp(bone):
        return lock_roll(loctrans(bone)).toEuler()[2]

Obviously see Jorge Rochas site for instructions on it’s use. Note that the name of the armature is assumed to be “Armature”, by the script.

@BenDansie: Yes the inside of the mouth needs work. I’m not sure whether to put in the entire throat etc, as it may never get seen, but the gums will definitely receive some attention.

The throat you can probably cheat with texture if the gums are getting work and it isn’t a focus area.

Hello Ben (Simonds), I have been away from this forum and Blender for a long time. I see my name mentioned here and I wouldn’t know about if you hadn’t sent an email from my neglected site.

I don’t know what Python idiosyncrasies make me not require the import line because it works for me like that. Adding it certainly doesn’t hurt and it is maybe better to stick to that rule if that will prevent problems, so thanks.

this is looking good so far, but her big toe seems a bit long and you should adjust the mass that runs from the thumb to the wrist on the palm side. Very nice effecient mesh!

Been busy today, she now has a full IK-FK switching rig, that incorporates twisting in the arms and legs. Unfortunately the deformations don’t look too good at the moment, particularly at the wrists, but I’m pretty pleased with the rig:D.

Red denotes IK controls, blue for FK.

I’m thinking I might get rid of the shapekeys and so forth, and add in some helper bones to deal with the deformations instead. Shapkeys seem to have a lot of disadvantages, much as they appear at first glance to be the easy way. This is particularly apparent when I decide I want to change the topology, and as I’ve decided now that the forearms need a major overhaul in this department, along with more minor tweaks in other areas, it looks like the shapekeys will have to go :rolleyes:.

Attachments


Very sexy! :smiley: I got a suggestion for a name - Yavorsgirl - great name for a great girl :wink:

Good job ben!!

Hey, I have a rigging system called BlenRig which doesn´t use shapekeys, it is based on the mesh deform modifier. If you want, I can help you rigging your character with BlenRig, or if you want I can rig it for you in a couple of hours (of my spare time).

Here are some links to show what I´m talking about:

Download BlenRig

Video Tutorials

@jpbouza: Your rig is very impressive, but I’m well under way with my own one now, and besides which I’m keen to learn to rig characters myself. I’d definitely welcome your advice though, as I’m currently struggling with the shoulder area, which I gather is one of the more tricky parts of a rig (especially without corrective shapekeys), and I’d like to know how other people have achieved it.

I´d definitely go for the mesh deform option, as with it, the mesh of the character is not only transformed by the bones, but it also slides along the influence of the mesh deform cage, and that is the trick for achieving good deformation and avoiding shrinking in difficult areas such as shoulders.

My advice is that you create a low poly mesh for the mesh deform modifier and try that technique. You can also grab BlenRig´s mesh deform cage and fit it to your model, or at least, take a look at the topology of my mesh deform object, cause that way you´ll know how I managed to get proper deformation in each of the areas. The main tip I can give you is that the deformation of the mesh deform cage has to make a kind of ¨pull up¨ effect in order to prevent shrinking in the joints.

Cheers!

Right, there’s a long way to go with rigging, but I’ve gotten to a point where I’d like to show what I have and possibly get some input. So here’s a blendfile (a little under 1MB). Notes are included in the .blend, and it’s pretty simple - red controls are IK, blue are FK, and some FK controls (just the forearm and hands mostly) can be used to tweak the pose even when the limb in question is in IK mode.
Current issues are:

  • The knees and elbows, which currently dont have any corrections applied.
  • The hips, which don’t deal at all well with sitting poses.
  • the torso doesn’t look good when bending over forwards.

Shoulders are getting better now:

Attachments


On a somewhat related note, I’ve been practising sculpting/texturing/skin shaders more generally. I had a go with maqs’ the layer SSS skin shader yesterday and got the following:

Textured:
http://img216.imageshack.us/img216/4511/oldmande9.jpg

No textures:
http://img7.imageshack.us/img7/3462/oldmanheadssshs9.jpg

Wires:
http://img299.imageshack.us/img299/3715/oldmanwiresvt9.jpg

SSS always seems to wash out the detail from bump maps and such, but I’m greadually getting better at implementing it believably.

Guys you are amazing I created new model of Céline Dion from year 2009 but i need tutorial how make best body hands and legs Raz88
http://www.celine.estranky.cz/archiv/iobrazek/23
I have i meantime head and hairs with neck

Work on a walkcycle. Animating is actually a great way of finding and ironing out the kinks in the rigging:


Edit: @PetrŠír: look up Ben Dansie’s thread on his female character, he’s currently in the process of writing a human body guide for the wiki.

Just some very rough texturing work so far, I think I need to refine the face a bit, it’s very smooth and uninteresting at the moment.
http://img509.imageshack.us/img509/2311/texturing1.jpg

She doesn’t really have enough forehead either, I think. It’s too round, too. What you have now is sort of bulb-like, most foreheads are fairly flattened off, sloping back from directly above the brow and getting their width from the edge the temples.

You don’t really have any prominent skeletal features right now, oddly—brow line, temples, cheekbones. Those all would really help with the ‘smoothness’ problem you’re facing.