ZBrushCentral

zsphere to bvh file ?

any reason why a bvh export option, for zspheres, would not be looked at ?
is this possible with zbscript ?

I’ve not looked closely but I don’t see why this wouldn’t be possible, within the limited capabilities of zspheres.

Yeah I’ve considered this before and it should be possible , like marcus said within limited capacity of ZSpheres and ZScript though, but I don’t see why it wouldn’t be possible. Even bvh import would be possible with ZScript, i.e. create ZSphere rig through zscript based on joint hierarchy defined in bvh and then interpolate angles etc for various frames based on rest of bvh channel data per frame.

I was working on ZAnimator lately but I don’t have time for it, or this bvh idea, because of uni. Though I should note that my honours project is in the field of animation and involves lots of mocap / bvh file handling so i understand the format quite well, but my project however is to do with new advanced animation techniques/maths research. :wink:

Cheers

Darukin
Could you tell me where you got your resources for BVH fomat.
I am working with the format as well.
I managed to get some code from a guy at a convention that did a lot of it for a mocap studio.
I am just looking for how its dealt with.

Thanks.

It would be great to import BHV files…translate it somehow to the zspheres and timeline. I would try to make my own script if someone could give me some tips i would really apreciate it.

Hi StephenCook, do you mean how do I parse bvh_files and / or export them?

So far I do this in C++ and OpenGL, you must research the structure/hierarchy of a bvh file to understand it though so you can parse it accordingly. It’s alot of work that I can’t explain in one post, however if I come across any particular reference I will post it here and I can try get some pseudo code soon if you want as far as how I parse it.

I’m very busy right now with this research project and dissertation though, but once I free up a little I will look into translating this for ZScript so that we can have a bvh_format parser for ZSpheres, which i think should be possible =)

@dargelos: unfortunately there’s no ZScript support for the active Zbrush timeline. However I have created my own timeline system in ZAnimator and were I to create bvh support I would integrate it with my own timeline for ZAnimator. I think it’s a really good idae you have though so I may look into this after my dissertation’s complete.

I better wait for your new version of Zanimator system… I hope the guys in pixologic gave more importance to the rigging animation part because i think its actually very good and the most of the people don’t use it much. I don’t know how hard it would be to paint the weights with masks as you suggested a long ago but it would be so cool.

My question is in regards to the formation of the BVH file from the refrence nodes.
I have looked at the BVH file format in detail and have a lot of resources that talk about Matrix calculations. The funny thing is that no one has described the process in a way that I can understand. For example they give the formula but no way to see it working. I mean I would like to at least see how the values of a node are plugged into the formula then the result is stored.
I know some of this is very advanced stuff however without seeing it in action its difficult to understand how the formula works.

What I am working on with the BVH format is not directly related to ZB here. I just need to understand how to apply the formula to a single node.

I understand the file format but what I need is to understand how the first few values are generated. The steps involved would be helpful.

Thanks for any assistance you may give.

:slight_smile:

I think to be able to I/O a standardized “bones” animation/rig (.bvh),
combined with the new .MDD I/O capability
will have powerful implications.

why not put I/O “hooks” on all the timeline tracks,
so that GoZ(t) can be achieved.

Also, would adding constraints to zspheres be just a few lines of code :
like:

if(thisZsphere.AngleTo(next_sphere) > 30) {
print “the rigs says don’t do that”;
//TODO : constrain the zsphere.
}

hey, just kidding,
it’s probably a lot more complicated than that.

http://www.character-studio.net/bvh_file_specification.htm

I really think it’s time PixolLogic looked into
http://www.swig.org/

zbscript is… an ugly button pressing macro thingy.
;p

#!/usr/bin/perl -w
use strict;

=head2 REFERENCES

http://www.pixologic.com/docs/index.php/ZScript_Command_Reference
http://www.character-studio.net/bvh_file_specification.htm

=cut

TODO : READ FROM FILE

my @bvh=undef;

sub bvh { # string[]
my $data = <<END_BVH;
HIERARCHY

ROOT Hips

{

OFFSET 20 0.00 0.00 CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation JOINT LeftHip { OFFSET 3.430000 0.000000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftKnee { OFFSET 0.000000 -18.469999 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftAnkle { OFFSET 0.000000 -17.950001 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.000000 -3.119996 0.000000 } } } } JOINT RightHip { OFFSET -3.430000 0.000000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightKnee { OFFSET 0.000000 -18.809999 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightAnkle { OFFSET 0.000000 -17.570000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.000000 -3.250000 0.000000 } } } } JOINT Chest { OFFSET 0.000000 4.570000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightCollar { OFFSET -1.060000 15.330000 1.760000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightShoulder { OFFSET -6.060000 0.000000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightElbow { OFFSET 0.000000 -11.900000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT RightWrist { OFFSET 0.000000 -9.520000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.000000 -7.140012 0.000000 } } } } } JOINT LeftCollar { OFFSET 1.060000 15.330000 1.760000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftShoulder { OFFSET 5.810000 0.000000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftElbow { OFFSET 0.000000 -12.080000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT LeftWrist { OFFSET 0.000000 -9.820000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.000000 -7.369996 0.000000 } } } } } JOINT Neck { OFFSET 0.000000 17.620001 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation JOINT Head { OFFSET 0.000000 5.190000 0.000000 CHANNELS 3 Zrotation Xrotation Yrotation End Site { OFFSET 0.000000 4.140008 0.000000 } } } }

}

MOTION

Frames: 222

Frame Time: 0.033333

0.00 39.88 -0.01 -1.79 -18.43 -1.74 5.02 -0.34 0.03 6.61 42.19 7.67 -3.87 -7.61 1.40 3.65 15.11 -0.95 2.33 11.06 -15.20 -7.25 -10.08 1.61 4.89 18.33 11.12 -17.68 0.00 0.60 40.98 9.99 22.36 0.00 -30.82 11.92 0.00 0.00 0.00 10.97 0.00 12.96 -37.45 -2.92 9.36 -180.00 -80.59 157.44 0.00 0.00 0.00 -35.59 52.18 0.00 11.29 -39.90 61.74

0.11 39.87 -0.01 -2.31 -17.29 -3.05 3.19 -4.22 0.24 7.38 40.49 -1.01 -3.87 -7.94 1.38 3.46 13.75 -0.82 2.47 11.44 -14.02 -7.25 -10.10 1.61 5.82 17.00 12.55 -17.36 0.00 2.00 42.28 10.77 34.97 -0.85 -22.68 14.90 0.00 0.00 0.00 10.01 0.00 11.77 -40.78 -3.61 6.09 -178.56 -87.20 158.39 0.00 0.00 0.00 -36.14 51.71 0.00 10.04 -38.83 61.13

0.22 39.88 0.02 -2.83 -16.47 -4.56 1.98 -6.94 0.24 6.27 37.48 -5.85 -3.87 -7.23 1.43 3.26 12.76 -0.72 2.52 11.87 -12.69 -7.25 -10.11 1.60 6.78 15.96 14.27 -16.96 0.00 3.28 44.28 12.02 51.41 -0.44 -17.87 20.64 0.00 0.00 0.00 9.19 0.00 10.84 -44.55 -3.26 2.86 -0.03 -85.90 -23.56 0.00 0.00 0.00 -36.74 50.88 0.00 9.12 -37.86 60.76

0.32 39.92 0.19 -3.51 -17.17 -7.03 1.79 -6.29 0.20 2.67 31.81 -3.40 -3.86 -5.65 1.54 2.98 13.46 -0.69 2.23 12.43 -10.34 -7.26 -10.29 1.58 7.48 16.60 16.65 -16.32 0.00 4.70 47.12 13.31 65.41 0.63 -16.14 26.83 0.00 0.00 0.00 8.37 0.00 9.94 -48.32 -2.20 -0.50 0.41 -78.48 -23.57 0.00 0.00 0.00 -37.20 49.91 0.00 8.35 -37.07 60.23

END_BVH

#@bvh = split /

/, $data;
return $data;
}

our $bVh=bvh; #sting;
our $depth=0; # int
our %root; # struct

our $zscript="// created by parsing bvh file
"; # string

start

my @bVh=split /
/,bvh; # []

buffer

my %previousNode;

for each line in the bvh file :

for my $i (0…scalar @bVh -1){

# OnCloseNode if( $bVh[$i] =~ /}$/){ $depth--; #print "$depth

";
};

# OnOpenNode if($bVh[$i] =~ /{$/){ #set the node index to the itterator my %node = ( index=&gt;$_ ); # determine the name an type of the node $bVh[$i-2] =~ m/(ROOT|JOINT)\s+(.+)/; if($1 and $2){ $node{type}=$1; $node{name}=$2; } # handle the terminator "i'll be back" if($bVh[$i-2] =~ /End Site/){ $node{type}="End Site"; $node{name}="End Site"; } # set the heirarchy depth of the node $node{level}=$depth; # goto next line until 'OFFSET' tag is found while( $bVh[$i] !~ /OFFSET/ ){$i++;} # get offset (valid for all node types) $bVh[$i] =~ m/OFFSET\s+(\S+)\s+(\S+)\s+(\S+)/; $node{offset} = { x=&gt;$1,y=&gt;$2,z=&gt;$3 }; # get the channels (valid only for root and joints) if($node{type} =~ /ROOT|JOINT/){ while( $bVh[$i] !~ /CHANNELS/ ){$i++;} $bVh[$i] =~ m/CHANNELS\s+(\d+)/; $node{channelCount}=$1 if $1; # get the names of the channels if($node{channelCount} and $node{channelCount}&gt;0){ print "these are $node{channelCount} channels.

";

# PROBLEM CODE &lt;???&gt;! my @split = split /(\w+)/,$bVh[$i]; #warn "Mal formed bvh : channel count does not match the name list.

"
# if $node{channelCount} != scalar @split;

# create the channel objects and add to node $node{channel}=[]; for(4...scalar @split-1) { my %newChannel = (name=&gt;$split[$_]); push @{$node{channel}}, %newChannel; } } } # TODO : determine criteria to set radius # set the radius of the zsphere $node{radius} =0.1; # set parent to previous if depth is greater then previous if(%previousNode and $node{level} &gt; $previousNode{level}){ $node{parent} = \%previousNode; ## check change push @{$previousNode{node}},%node; } # if depth is same as previous, introduce sybling to parent if(%previousNode and $node{level} == $previousNode{level}){ $node{parent} = $previousNode{parent}; push @{$previousNode{node}},%node; } # concatenate zscript $zscript .= "//$node{name}

";

if($node{parent} and $node{parent}{index}){ $zscript .= " [ZSphereAdd,$node{offset}{x}, $node{offset}{y},$node{offset}{z},$node{radius},$node{parent}{index}]

";
} else {
$zscript .= " [ZSphereAdd,$node{offset}{x}, $node{offset}{y},$node{offset}{z},$node{radius}]
";
}

# set orphan node as root, works but dodgey %root = %node if ! $node{parent}; # buffer previous node %previousNode = %node; $depth++; }

}

print $zscript;