Feb 272011

This is a very simple script I wrote to make BVH’s exported from DANCE (Dynamic Animation and Control Environment) able to be imported into Blender.

It just adds blank channels to joints if there are less than 3.

-Simple BVH file thing that adds blank channels of
    position to JOINTS and FRAMES to allow BVH Exports from 
    DANCE (Dynamic Animation and Control Environment) to be
    imported into Blender.
teldredge - www.funkboxing.com

infile = "c:\workspace\bvhMINE\bvhdata\skelORIG2.bvh"
outfile = "c:\workspace\bvhMINE\bvhdata\skelTESTOUT.bvh"

def loadDANCEBVH(fin, fout):
    tab = chr(9)
    f = open(fin, 'r')
    lines = f.readlines()
    newlines = list(lines)
    newlines[16] = str(tab+tab+tab+tab+"CHANNELS 3 Xrotation Yrotation Zrotationn")
    newlines[30] = str(tab+tab+tab+tab+"CHANNELS 3 Yrotation Xrotation Zrotationn")
    newlines[34] = str(tab+tab+tab+tab+"CHANNELS 3 Yrotation Zrotation Xrotationn")
    newlines[49] = str(tab+tab+tab+tab+"CHANNELS 3 Yrotation Xrotation Zrotationn")    
    newlines[53] = str(tab+tab+tab+tab+"CHANNELS 3 Yrotation Zrotation Xrotationn")    
    newlines[69] = str(tab+tab+tab+tab+"CHANNELS 3 Xrotation Yrotation Zrotationn")    
    newlines[73] = str(tab+tab+tab+tab+"CHANNELS 3 Xrotation Zrotation Yrotationn")    
    newlines[88] = str(tab+tab+tab+tab+"CHANNELS 3 Xrotation Yrotation Zrotationn")
    newlines[92] = str(tab+tab+tab+tab+"CHANNELS 3 Xrotation Zrotation Yrotationn")    

    for li in range(104, len(lines)):
        vals = lines[li].split(" ")
        vals.insert(12, '0')
        vals.insert(12, '0')
        vals.insert(19, '0')
        vals.insert(21, '0')
        vals.insert(27, '0')
        vals.insert(30, '0')
        vals.insert(30, '0')
        vals.insert(35, '0')
        vals.insert(35, '0')
        vals.insert(39, '0')
        vals.insert(44, '0')
        vals.insert(44, '0')
        vals.insert(48, '0')
        newlines[li] = " ".join(vals) 
    fo = open(fout, 'w')
loadDANCEBVH(infile, outfile)
Feb 222011

There’s a lot of Kinect-driven mocap development going on and that is fantastic. I also wanted to show off a couple of other animation tools out there. I’d like to see more physics and algorithmic animation tools available and I found a couple of very promising pieces of open-source software.

cartwheel-3d – Physics Based Character Animation Framework

DANCE – Dynamic Animation and Control Environment

Both can be used to create animation with a combination of physics and scripted control. The details of how they work are beyond me, but what they do is pretty amazing. Both are written in c++ but they both heavily use python for scripting and UI.

I am working with cartwheel-3d to try and use some of the features in Blender. I could try to work out a simple BVH exporter for cartwheel, or maybe an OSC server to send animation data to be recorded in Blender. Or simply try to use the functions direction in Blender. Still haven’t got that far. So far all I’ve done is compile cartwheel-3d. So I’ve included some notes on how I did it so if anyone else wants to work on this too they can get started easier.

-Basically I followed the instructions on the ‘Get Started‘ page for cartwheel-3d with a few important exceptions.

COMPILING C++ : MS VStudioExpress2010
*no spaces in paths!
*lib folder in workspace ie. “C:workspacelib”
*glew32.dll and glut32.dll lib and lib in PATH variable

-After getting repository and opening- VS2010 converts and messes up target and extensions. To fix this.
-Change Target Name from $(ProjectName) to _$(ProjectName)
-Change Target Extension to .pyd
-Repeat on all projects except ode and gls
-Repeat on debug and release

-Make sure BROWSE INFORMATION is OFF on all projects

-Open eclipse (classic)
-Install pydev
-Set interpreter to py26
-Make a copy of ‘cartwheel-3d’ project folder- rename ‘simbicon’
-Install wxpython
-Install pyopengl

-Got some error about Core.py returning _mod before assignment. not sure what I did to siz it- sorry. I remember I opened core.py in the editor to look for the error, then ran again and it worked… weird.

So that’s it for now. Hope to do something constructive with this.

Feb 202011

I added a ‘VerletHinge’ class that’s a little hacky but it works to give rotation limits on certain joints. Provides slightly more lifelike flailing… also added a little drawing touch and made the ragdoll hang out until clicked.

Feb 202011

Collection of the videos I did for various bands.

Destruction of the Western Hemisphere (Blues and the Gunfighters)

The Rich Don’t Die


Movin’ Weight – South Park Medley

Feb 202011

[EDIT] – Just wanted to post this here in case I forget:

A driver can use the current frame in the expression with – bpy.context.scene.frame_current

So you could do something like: sin((bpy.context.scene.frame_current-10)/5)

BUT!!! After 2.68 expressions in drivers only work if you have Auto Run Python Scripts turned on in UserPrefs>File


B2.56 doesn’t have proper events yet – so this is a hacky way to drive scene animation. I forgot where I found this info – but it worked so I wanted to make it available.
1) create Empty
2) add single keyframe to Zrot (frame 1)
– should have default expanded poly generator on it
3) add single driver to Yloc (frame1)
– in Drivers> choose – Scripted sxpression
– enter this expression

float(exec("\n".join([l.body for l in bpy.data.texts["RUN"].lines]))==None)

4) then a script called ‘RUN’ should execute every time the frame changes
– Zrot of Empty drives expression which (i think) grabs the text datablock of the script and runs it

here’s a quick thing I did. set up the empty as above…
then make a cube (named ‘Cube’) subdivide it a lot, then run this-

 import bpy import random ob = bpy.data.objects['Cube'] verts = ob.data.vertices for v in verts: rxnum = round(random.uniform(-0.01 ,0.01), 4) rynum = round(random.uniform(-0.01 ,0.01), 4) rznum = round(random.uniform(-0.01 ,0.01), 4) v.co[0] = v.co[0] + rxnum v.co[1] = v.co[1] + rynum v.co[2] = v.co[2] + rznum scene = bpy.context.scene 


Feb 182011

A jingle and demo video I made for my favorite piece of software. This was back for 2.49

Feb 182011

My submission for The Linux Foundation 2010 ‘Superbowl Ad’ contest.

Made with Blender.

Feb 182011

Here are two models I made awhile ago for fun. I decided to make them low poly so I could put them up on the web here. I know the viewer is crappy – I’ll work on it later.
Anyway here they are.

Gumby .blend .png

Pokey .blend .png

…and here’s the animation I made from these awhile back