Ackso-Mocap

For this project, I wanted to create one abstract form that is controlled by several dancing bodies. I used several bodies rather than one so that the movement of each would combine into a more complex and abstract form of motion. First, I recorded motion data of myself dancing to Phoenix’s “If I Ever Feel Better” three times, keeping relatively still until the chorus. I did this so that the motion of the combined form would start out calm and then get more sporadic; to add to this, I intentionally moved too fast for the Kinect to follow me during the climax of the song. I then drew simple bodies using triangles; however, the bodies do not represent a motion capture recording. Instead, each abstracted form is controlled by one half of two different skeletons, so in order to truly understand how I was dancing, one would have to look at the combination of multiple separate shapes. The aim of this was to make it seem like the whole shape, rather than the three bodies individually, was dancing.

 

PBvh myBrekelBvh;
PBvh myBrekelBvh2;
PBvh body3;
float rotation = 0;
PVector hip1 = new PVector();
PVector hip2 = new PVector();
PVector hip3 = new PVector();
PVector head1 = new PVector();
PVector head2 = new PVector();
PVector head3 = new PVector();
PVector leftKnee1 = new PVector();
PVector leftKnee2 = new PVector();
PVector leftKnee3 = new PVector();
PVector leftHand1 = new PVector();
PVector leftHand2 = new PVector();
PVector leftHand3 = new PVector();
PVector rightHand1 = new PVector();
PVector rightHand2 = new PVector();
PVector rightHand3 = new PVector();
PVector rightFoot1 = new PVector();
PVector rightFoot2 = new PVector();
PVector rightFoot3 = new PVector();
PVector leftFoot1 = new PVector ();
PVector leftFoot2 = new PVector ();
PVector leftFoot3 = new PVector ();
 
 
 
//------------------------------------------------
void setup() {
  size( 1280, 720, P3D );
 
  // Load a BVH file recorded with a Kinect v2, made in Brekel Pro Body v2.
  myBrekelBvh = new PBvh( loadStrings( "dance1.bvh" ) );
  myBrekelBvh2 = new PBvh( loadStrings( "dance2.bvh" ) );
  body3= new PBvh( loadStrings( "dance3.bvh" ) );
}
 
//------------------------------------------------
void draw() {
  lights() ;
  background(0);
  rotation+=.1; 
 
 
 
 
  setMyCamera();        // Position the camera. See code below.
 
  updateAndDrawBody();  // Update and render the BVH file. See code below.
 
  noStroke();
  fill(0,0,255);
  beginShape();
  vertex(head1.x,head1.y,head1.z);
  vertex(head2.x,head2.y,head2.z);
  vertex(head3.x,head3.y,head3.z);
  endShape();
 
  fill(229, 42, 0);
  beginShape();
  vertex(leftFoot1.x,leftFoot1.y,leftFoot1.z);
  vertex(rightFoot3.x,rightFoot3.y,rightFoot3.z);
  vertex(leftHand1.x,leftHand1.y,leftHand1.z);
  vertex(rightHand3.x,rightHand3.y,rightHand3.z);
  endShape();
 
  fill(255,0,0);
  beginShape();
  vertex(rightFoot1.x,rightFoot1.y,rightFoot1.z);
  vertex(leftFoot2.x,leftFoot2.y,leftFoot2.z);
  vertex(rightHand1.x,rightHand1.y,rightHand1.z);
  vertex(leftHand2.x,leftHand2.y,leftHand2.z);
  endShape();
 
  fill(229, 34, 105);
  beginShape();
  vertex(rightFoot2.x,rightFoot2.y,rightFoot2.z);
  vertex(leftFoot3.x,leftFoot3.y,leftFoot3.z);
  vertex(rightHand2.x,rightHand2.y,rightHand2.z);
  vertex(leftHand3.x,leftHand3.y,leftHand3.z);
  endShape();
 
  fill(0, 242, 255);
  beginShape();
  vertex(hip1.x,hip1.y,hip1.z);
  vertex(hip2.x,hip2.y,hip2.z);
  vertex(hip3.x,hip3.y,hip3.z);
  endShape();
 
 
 
}
 
 
//------------------------------------------------
void updateAndDrawBody() {
  pushMatrix(); 
  translate(width/2, height/2+100, 200); 
  scale(-1, -1, 1); 
 
 
  myBrekelBvh.update(millis()); 
 
  BvhBone bone=myBrekelBvh.parser.getBones().get(0);
 
  hip1.x=modelX(bone.absPos.x,bone.absPos.y,bone.absPos.z);
  hip1.y=modelY(bone.absPos.x,bone.absPos.y,bone.absPos.z);
  hip1.z=modelZ(bone.absPos.x,bone.absPos.y,bone.absPos.z);
 
  BvhBone headBone1=myBrekelBvh.parser.getBones().get(48);
 
  head1.x=modelX(headBone1.absPos.x,headBone1.absPos.y,headBone1.absPos.z);
  head1.y=modelY(headBone1.absPos.x,headBone1.absPos.y,headBone1.absPos.z);
  head1.z=modelZ(headBone1.absPos.x,headBone1.absPos.y,headBone1.absPos.z);
 
  BvhBone leftKneeBone1=myBrekelBvh.parser.getBones().get(2);
 
  leftKnee1.x=modelX(leftKneeBone1.absPos.x,leftKneeBone1.absPos.y,leftKneeBone1.absPos.z);
  leftKnee1.y=modelY(leftKneeBone1.absPos.x,leftKneeBone1.absPos.y,leftKneeBone1.absPos.z);
  leftKnee1.z=modelZ(leftKneeBone1.absPos.x,leftKneeBone1.absPos.y,leftKneeBone1.absPos.z);
 
  BvhBone leftHandBone1=myBrekelBvh.parser.getBones().get(12);
 
  leftHand1.x=modelX(leftHandBone1.absPos.x,leftHandBone1.absPos.y,leftHandBone1.absPos.z);
  leftHand1.y=modelY(leftHandBone1.absPos.x,leftHandBone1.absPos.y,leftHandBone1.absPos.z);
  leftHand1.z=modelZ(leftHandBone1.absPos.x,leftHandBone1.absPos.y,leftHandBone1.absPos.z);
 
  BvhBone rightHandBone1= myBrekelBvh.parser.getBones().get(31);
 
  rightHand1.x=modelX(rightHandBone1.absPos.x,rightHandBone1.absPos.y,rightHandBone1.absPos.z);
  rightHand1.y=modelY(rightHandBone1.absPos.x,rightHandBone1.absPos.y,rightHandBone1.absPos.z);
  rightHand1.z=modelZ(rightHandBone1.absPos.x,rightHandBone1.absPos.y,rightHandBone1.absPos.z);
 
  BvhBone leftFootBone1= myBrekelBvh.parser.getBones().get(3);
 
  leftFoot1.x=modelX(leftFootBone1.absPos.x,leftFootBone1.absPos.y,leftFootBone1.absPos.z);
  leftFoot1.y=modelY(leftFootBone1.absPos.x,leftFootBone1.absPos.y,leftFootBone1.absPos.z);
  leftFoot1.z=modelZ(leftFootBone1.absPos.x,leftFootBone1.absPos.y,leftFootBone1.absPos.z);
 
  BvhBone rightFootBone1= myBrekelBvh.parser.getBones().get(6);
 
  rightFoot1.x=modelX(rightFootBone1.absPos.x,rightFootBone1.absPos.y,rightFootBone1.absPos.z);
  rightFoot1.y=modelY(rightFootBone1.absPos.x,rightFootBone1.absPos.y,rightFootBone1.absPos.z);
  rightFoot1.z=modelZ(rightFootBone1.absPos.x,rightFootBone1.absPos.y,rightFootBone1.absPos.z);
 
  popMatrix();
 
 
 
  pushMatrix();
  translate(width/2+370,height/2+100,0);
  scale(-1, -1, 1); 
  rotateY(-3*PI/8);
 
 
  myBrekelBvh2.update(millis());
  BvhBone bone2=myBrekelBvh2.parser.getBones().get(0);
  hip2.x=modelX(bone2.absPos.x,bone2.absPos.y,bone2.absPos.z);
  hip2.y=modelY(bone2.absPos.x,bone2.absPos.y,bone2.absPos.z);
  hip2.z=modelZ(bone2.absPos.x,bone2.absPos.y,bone2.absPos.z);
 
  BvhBone headBone2=myBrekelBvh2.parser.getBones().get(48);
 
  head2.x=modelX(headBone2.absPos.x,headBone2.absPos.y,headBone2.absPos.z);
  head2.y=modelY(headBone2.absPos.x,headBone2.absPos.y,headBone2.absPos.z);
  head2.z=modelZ(headBone2.absPos.x,headBone2.absPos.y,headBone2.absPos.z);
 
  BvhBone leftKneeBone2=myBrekelBvh2.parser.getBones().get(2);
 
  leftKnee2.x=modelX(leftKneeBone2.absPos.x,leftKneeBone2.absPos.y,leftKneeBone2.absPos.z);
  leftKnee2.y=modelY(leftKneeBone2.absPos.x,leftKneeBone2.absPos.y,leftKneeBone2.absPos.z);
  leftKnee2.z=modelZ(leftKneeBone2.absPos.x,leftKneeBone2.absPos.y,leftKneeBone2.absPos.z);
 
  BvhBone leftHandBone2=myBrekelBvh2.parser.getBones().get(12);
 
  leftHand2.x=modelX(leftHandBone2.absPos.x,leftHandBone2.absPos.y,leftHandBone2.absPos.z);
  leftHand2.y=modelY(leftHandBone2.absPos.x,leftHandBone2.absPos.y,leftHandBone2.absPos.z);
  leftHand2.z=modelZ(leftHandBone2.absPos.x,leftHandBone2.absPos.y,leftHandBone2.absPos.z);
 
  BvhBone rightHandBone2= myBrekelBvh2.parser.getBones().get(31);
 
  rightHand2.x=modelX(rightHandBone2.absPos.x,rightHandBone2.absPos.y,rightHandBone2.absPos.z);
  rightHand2.y=modelY(rightHandBone2.absPos.x,rightHandBone2.absPos.y,rightHandBone2.absPos.z);
  rightHand2.z=modelZ(rightHandBone2.absPos.x,rightHandBone2.absPos.y,rightHandBone2.absPos.z);
 
  BvhBone leftFootBone2= myBrekelBvh2.parser.getBones().get(3);
 
  leftFoot2.x=modelX(leftFootBone2.absPos.x,leftFootBone2.absPos.y,leftFootBone2.absPos.z);
  leftFoot2.y=modelY(leftFootBone2.absPos.x,leftFootBone2.absPos.y,leftFootBone2.absPos.z);
  leftFoot2.z=modelZ(leftFootBone2.absPos.x,leftFootBone2.absPos.y,leftFootBone2.absPos.z);
 
  BvhBone rightFootBone2= myBrekelBvh2.parser.getBones().get(6);
 
  rightFoot2.x=modelX(rightFootBone2.absPos.x,rightFootBone2.absPos.y,rightFootBone2.absPos.z);
  rightFoot2.y=modelY(rightFootBone2.absPos.x,rightFootBone2.absPos.y,rightFootBone2.absPos.z);
  rightFoot2.z=modelZ(rightFootBone2.absPos.x,rightFootBone2.absPos.y,rightFootBone2.absPos.z);
 
  popMatrix();
 
 
 
  pushMatrix();
  translate(width/2-200,height/2+100,-300);
  scale(-1, -1, 1); 
  rotateY(2*PI/3);
 
  body3.update(millis());
  BvhBone bone3=body3.parser.getBones().get(0);
  hip3.x=modelX(bone3.absPos.x,bone3.absPos.y,bone3.absPos.z);
  hip3.y=modelY(bone3.absPos.x,bone3.absPos.y,bone3.absPos.z);
  hip3.z=modelZ(bone3.absPos.x,bone3.absPos.y,bone3.absPos.z);
 
  BvhBone headBone3=body3.parser.getBones().get(48);
 
  head3.x=modelX(headBone3.absPos.x,headBone3.absPos.y,headBone3.absPos.z);
  head3.y=modelY(headBone3.absPos.x,headBone3.absPos.y,headBone3.absPos.z);
  head3.z=modelZ(headBone3.absPos.x,headBone3.absPos.y,headBone3.absPos.z);
 
  BvhBone leftKneeBone3=body3.parser.getBones().get(2);
 
  leftKnee3.x=modelX(leftKneeBone3.absPos.x,leftKneeBone3.absPos.y,leftKneeBone3.absPos.z);
  leftKnee3.y=modelY(leftKneeBone3.absPos.x,leftKneeBone3.absPos.y,leftKneeBone3.absPos.z);
  leftKnee3.z=modelZ(leftKneeBone3.absPos.x,leftKneeBone3.absPos.y,leftKneeBone3.absPos.z);
 
  BvhBone leftHandBone3=body3.parser.getBones().get(12);
 
  leftHand3.x=modelX(leftHandBone3.absPos.x,leftHandBone3.absPos.y,leftHandBone3.absPos.z);
  leftHand3.y=modelY(leftHandBone3.absPos.x,leftHandBone3.absPos.y,leftHandBone3.absPos.z);
  leftHand3.z=modelZ(leftHandBone3.absPos.x,leftHandBone3.absPos.y,leftHandBone3.absPos.z);
 
  BvhBone rightHandBone3= body3.parser.getBones().get(31);
 
  rightHand3.x=modelX(rightHandBone3.absPos.x,rightHandBone3.absPos.y,rightHandBone3.absPos.z);
  rightHand3.y=modelY(rightHandBone3.absPos.x,rightHandBone3.absPos.y,rightHandBone3.absPos.z);
  rightHand3.z=modelZ(rightHandBone3.absPos.x,rightHandBone3.absPos.y,rightHandBone3.absPos.z);
 
  BvhBone leftFootBone3= body3.parser.getBones().get(3);
 
  leftFoot3.x=modelX(leftFootBone3.absPos.x,leftFootBone3.absPos.y,leftFootBone3.absPos.z);
  leftFoot3.y=modelY(leftFootBone3.absPos.x,leftFootBone3.absPos.y,leftFootBone3.absPos.z);
  leftFoot3.z=modelZ(leftFootBone3.absPos.x,leftFootBone3.absPos.y,leftFootBone3.absPos.z);
 
  BvhBone rightFootBone3= body3.parser.getBones().get(6);
 
  rightFoot3.x=modelX(rightFootBone3.absPos.x,rightFootBone3.absPos.y,rightFootBone3.absPos.z);
  rightFoot3.y=modelY(rightFootBone3.absPos.x,rightFootBone3.absPos.y,rightFootBone3.absPos.z);
  rightFoot3.z=modelZ(rightFootBone3.absPos.x,rightFootBone3.absPos.y,rightFootBone3.absPos.z);
  popMatrix();
}
 
 
//------------------------------------------------
void setMyCamera() {
 
  // Adjust the position of the camera
  //float eyeX = mouseX;          // x-coordinate for the eye
  float eyeY = mouseY;   // y-coordinate for the eye
  //float eyeZ = 350;             // z-coordinate for the eye
  float centerX = width/2+100;   // x-coordinate for the center of the scene
  float centerY = height/2.0f-50;  // y-coordinate for the center of the scene
  float centerZ = -100;         // z-coordinate for the center of the scene
  float upX = 0;                // usually 0.0, 1.0, or -1.0
  float upY = 1;                // usually 0.0, 1.0, or -1.0
  float upZ = 0;            // usually 0.0, 1.0, or -1.0
 
  float orbitRadius = 275;
 
  float eyeX= cos(radians(rotation))*orbitRadius+700;
  float eyeZ= sin(radians(rotation))*orbitRadius-175;
 
 
  camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
}
 
//------------------------------------------------
void drawMyGround() {
  // Draw a grid in the center of the ground 
  pushMatrix(); 
  translate(width/2, height/2, 0); // position the body in space
  scale(-1, -1, 1);
 
  stroke(100);
  strokeWeight(1); 
 
  float gridSize = 400; 
  int nGridDivisions = 10; 
 
  for (int col=0; col<=nGridDivisions; col++) {
    float x = map(col, 0, nGridDivisions, -gridSize, gridSize);
    line (x, 0, -gridSize, x, 0, gridSize);
  }
  for (int row=0; row<=nGridDivisions; row++) {
    float z = map(row, 0, nGridDivisions, -gridSize, gridSize); 
    line (-gridSize, 0, z, gridSize, 0, z);
  }
 
  popMatrix();
}