User Friendly DTS
by Jeff Murray · in Artist Corner · 05/22/2007 (11:06 pm) · 4 replies
One of the things im currently working on is improving the Maya DTS menu's, I'll see if my company is ok with me sharing them here,
this menu lets you browse to the folder you want the DTS objects to apear, then you can export multiple unique objects at once, it also has a "Happy Button***" that sets up Maya with all the torque settings (grid etc..)
this automatically creates your detail lvl based on your input on the menu
exported DTS file is named after your object in Maya
***for those wondering... yes, I used a smiley image :)
im currently working towards instanced objects, having a fun time with euler to Quaternion in Maya
I was wondering if anyone has the algorythm for that, i have one partially written through trial and error
if ayone has any info, either email me at mike@simpletofind.ca or post here
thanks
-Mike
this menu lets you browse to the folder you want the DTS objects to apear, then you can export multiple unique objects at once, it also has a "Happy Button***" that sets up Maya with all the torque settings (grid etc..)
this automatically creates your detail lvl based on your input on the menu
exported DTS file is named after your object in Maya
***for those wondering... yes, I used a smiley image :)
im currently working towards instanced objects, having a fun time with euler to Quaternion in Maya
I was wondering if anyone has the algorythm for that, i have one partially written through trial and error
if ayone has any info, either email me at mike@simpletofind.ca or post here
thanks
-Mike
#2
Unfortunately I am unable to give out the tool as it is in house only, but I can share my snippets of math equation for the proper ueler to quaternion
ive done most of the figuring out, it works on most angles up to a certain tolerance, then it explodes and deforms the shape in torque, when I get some time to put towards this Ill post either an update or the finished snippet
-Mike
05/24/2007 (11:20 am)
These posts are on behalf of Mike Paixao, he is doing the work on this,Unfortunately I am unable to give out the tool as it is in house only, but I can share my snippets of math equation for the proper ueler to quaternion
ive done most of the figuring out, it works on most angles up to a certain tolerance, then it explodes and deforms the shape in torque, when I get some time to put towards this Ill post either an update or the finished snippet
-Mike
#3
heres what ive come up with, havnt had much time, its not perfect, but if you only rotate on 2 axes (wich can do all rotations...) and you set Maya's graph editor to Quaternion curves instead of Euler
note: I will finish this once I finish the exporter, although I cannot share the source,
I will try to get a plugin version out
as right now it exports LOD objects, exports all known flags, and creates a nice little data block you just cut and paste into the mission file...
working on rotation instance objects...
yes... I have alot of un-used variables... I know :P
///////////////////////////////////////////////////
// Written by Mike Paixao //
// www.FuelIndustries.com //
// //
// last Modified: June 1/2007 //
///////////////////////////////////////////////////
// gets XYZ information //
$x = 'getAttr .rx';
$y = 'getAttr .ry';
$z = 'getAttr .rz';
///// Math, wonderfull math! /////
$c1 = 'cos($x/2)';
$c2 = 'cos($y/2)';
$c3 = 'cos($z/2)';
$s1 = 'sin($x/2)';
$s2 = 'sin($y/2)';
$s3 = 'sin($z/2)';
/// Quaternion for X Y Z W ///
$w = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
//$qx = ( $s1 * $s2 * $c3 + $c1 * $c2 * $s3 );
//$qy = ( $s1 * $c2 * $c3 + $c1 * $s2 * $s3 );
//$qz = ( $c1 * $s2 * $c3 - $s1 * $c2 * $s3 );
$q[0] = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
$q[1] = ( $s1 * $s2 * $c3 + $c1 * $c2 * $s3 );
$q[2] = ( $s1 * $c2 * $c3 + $c1 * $s2 * $s3 );
$q[3] = ( $c1 * $s2 * $c3 - $s1 * $c2 * $s3 );
//print $q;
// now for the angle.... more math!!! //
// ...normalize it //
$magnitude = sqrt($x*$x + $y*$y + $z*$z + $w*$w);
$nq[0] = $x / $magnitude;
$nq[1] = $y / $magnitude;
$nq[2] = $z / $magnitude;
$nq[3] = $w / $magnitude;
//print $nq;
//print $w;
$ww = $w*$w;
$ang = sqrt(1-$ww);
//$aa[0] = $x / $ang;
//$aa[1] = $y / $ang;
//$aa[2] = $z / $ang;
$angle = acosd($w);
// these switch variables for torque //
$nqq[0] = $nq[0]*-1;
$nqq[1] = $angle*-1;
print ($nq[2]+" "+$nqq[0]+" "+$nq[1]+" "+$nqq[1]);
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
06/01/2007 (11:03 am)
This is another post for Mike Paixao ( should really get an account of my own! :P )heres what ive come up with, havnt had much time, its not perfect, but if you only rotate on 2 axes (wich can do all rotations...) and you set Maya's graph editor to Quaternion curves instead of Euler
note: I will finish this once I finish the exporter, although I cannot share the source,
I will try to get a plugin version out
as right now it exports LOD objects, exports all known flags, and creates a nice little data block you just cut and paste into the mission file...
working on rotation instance objects...
yes... I have alot of un-used variables... I know :P
///////////////////////////////////////////////////
// Written by Mike Paixao //
// www.FuelIndustries.com //
// //
// last Modified: June 1/2007 //
///////////////////////////////////////////////////
// gets XYZ information //
$x = 'getAttr .rx';
$y = 'getAttr .ry';
$z = 'getAttr .rz';
///// Math, wonderfull math! /////
$c1 = 'cos($x/2)';
$c2 = 'cos($y/2)';
$c3 = 'cos($z/2)';
$s1 = 'sin($x/2)';
$s2 = 'sin($y/2)';
$s3 = 'sin($z/2)';
/// Quaternion for X Y Z W ///
$w = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
//$qx = ( $s1 * $s2 * $c3 + $c1 * $c2 * $s3 );
//$qy = ( $s1 * $c2 * $c3 + $c1 * $s2 * $s3 );
//$qz = ( $c1 * $s2 * $c3 - $s1 * $c2 * $s3 );
$q[0] = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
$q[1] = ( $s1 * $s2 * $c3 + $c1 * $c2 * $s3 );
$q[2] = ( $s1 * $c2 * $c3 + $c1 * $s2 * $s3 );
$q[3] = ( $c1 * $s2 * $c3 - $s1 * $c2 * $s3 );
//print $q;
// now for the angle.... more math!!! //
// ...normalize it //
$magnitude = sqrt($x*$x + $y*$y + $z*$z + $w*$w);
$nq[0] = $x / $magnitude;
$nq[1] = $y / $magnitude;
$nq[2] = $z / $magnitude;
$nq[3] = $w / $magnitude;
//print $nq;
//print $w;
$ww = $w*$w;
$ang = sqrt(1-$ww);
//$aa[0] = $x / $ang;
//$aa[1] = $y / $ang;
//$aa[2] = $z / $ang;
$angle = acosd($w);
// these switch variables for torque //
$nqq[0] = $nq[0]*-1;
$nqq[1] = $angle*-1;
print ($nq[2]+" "+$nqq[0]+" "+$nq[1]+" "+$nqq[1]);
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
#4
this one is short at sweet, a trick to make sure it works is to set a key on the object, make the curves in the graph editor Quaternion
do that with a simple script ( rotationInterpolation -convert quaternion objectNameHere_rotateX; ) this will convert XYZ to Quaternion
as far as this section goes, I just have to organize the X Y Z so it places it properly, wich im doing now and should be done shortly
//////////////////////////////////////////////////////
// Written by Mike Paixao //
// www.FuelIndustries.com //
// mdeschamps@fuelIndustries.com //
// last Modified: June 4/2007 //
///////////////////////////////////////////////////
// start Quaternion Calc //
$x = 'getAttr .rx';
$tx = $x*-1;
$y = 'getAttr .ry';
$z = 'getAttr .rz';
$c1 = 'cos($x/2)';
$c2 = 'cos($y/2)';
$c3 = 'cos($z/2)';
$s1 = 'sin($x/2)';
$s2 = 'sin($y/2)';
$s3 = 'sin($z/2)';
$w = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
// normalizes the results
$angle = sqrt($x*$x + $y*$y + $z*$z + $w*$w);
$xn = $x / $angle;
$yn = $y / $angle;
$zn = $z / $angle;
$wn = $w / $angle;
// end Quaternion calc //
print ($xn+" "+$zn+" "+$yn+" "+$angle);
06/04/2007 (10:55 am)
Another post for Mike Paixao ( any admins able to get Mike his own dev account? :P )this one is short at sweet, a trick to make sure it works is to set a key on the object, make the curves in the graph editor Quaternion
do that with a simple script ( rotationInterpolation -convert quaternion objectNameHere_rotateX; ) this will convert XYZ to Quaternion
as far as this section goes, I just have to organize the X Y Z so it places it properly, wich im doing now and should be done shortly
//////////////////////////////////////////////////////
// Written by Mike Paixao //
// www.FuelIndustries.com //
// mdeschamps@fuelIndustries.com //
// last Modified: June 4/2007 //
///////////////////////////////////////////////////
// start Quaternion Calc //
$x = 'getAttr .rx';
$tx = $x*-1;
$y = 'getAttr .ry';
$z = 'getAttr .rz';
$c1 = 'cos($x/2)';
$c2 = 'cos($y/2)';
$c3 = 'cos($z/2)';
$s1 = 'sin($x/2)';
$s2 = 'sin($y/2)';
$s3 = 'sin($z/2)';
$w = ( $c1 * $c2 * $c3 - $s1 * $s2 * $s3 );
// normalizes the results
$angle = sqrt($x*$x + $y*$y + $z*$z + $w*$w);
$xn = $x / $angle;
$yn = $y / $angle;
$zn = $z / $angle;
$wn = $w / $angle;
// end Quaternion calc //
print ($xn+" "+$zn+" "+$yn+" "+$angle);
Torque 3D Owner James