Announcement

Collapse
No announcement yet.

Changing y-axis to z-axis

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing y-axis to z-axis

    I'm messing around with Icarus and have tracked the motion of a camera and exported a maxscript file that contains all the tracking data. I believe that Icarus treats 'y' as up, so my script file needs to be modified accordingly (either that, or the camera and all the points that are brought in using the ms file need to be 'rotated'.

    What is the best way to do this? Here is a sample of my ms file:
    Code:
    animationRange = interval 0f 691f
    point cross:off centermarker:on pos:[0.0, 0.0, 0.0] name:"icarus_data"
     
    animate on (
    c0 = freecamera name:"Camera1"
    c0.nearclip = 0.0
    c0.clipManually = true
    c0.parent = $icarus_data
    at time 0f c0.rotation = quat 0.000000 -0.000000 0.000000 1.000000
    at time 0f c0.position = [-0.483996,-2.878143,-0.046705]
    at time 0f c0.fov = 58.091346
    at time 1f c0.rotation = quat 0.000959 -0.000914 -0.000417 0.999999
    at time 1f c0.position = [-0.629683,-2.824616,-0.170974]
    at time 1f c0.fov = 58.091346
    at time 2f c0.rotation = quat 0.001821 -0.001937 -0.000741 0.999996
    at time 2f c0.position = [-0.790466,-2.768693,-0.286030]
    at time 2f c0.fov = 58.091346
    at time 3f c0.rotation = quat 0.002723 -0.002756 -0.001297 0.999992
    at time 3f c0.position = [-0.926598,-2.712467,-0.416298]
    at time 3f c0.fov = 58.091346
    at time 4f c0.rotation = quat 0.003536 -0.003674 -0.001718 0.999986
    at time 4f c0.position = [-1.074846,-2.651112,-0.539843]
    at time 4f c0.fov = 58.091346
    at time 5f c0.rotation = quat 0.004503 -0.004626 -0.002044 0.999977
    at time 5f c0.position = [-1.227960,-2.601038,-0.662030]
    at time 5f c0.fov = 58.091346
    at time 6f c0.rotation = quat 0.005388 -0.005428 -0.002368 0.999968
    at time 6f c0.position = [-1.366198,-2.545368,-0.789632]
    at time 6f c0.fov = 58.091346
    at time 7f c0.rotation = quat 0.006286 -0.006310 -0.002878 0.999956
    at time 7f c0.position = [-1.509577,-2.485998,-0.916880]
    at time 7f c0.fov = 58.091346
    etc
    etc
    etc
    )
    point cross:off centermarker:on pos:[0.0, 0.0, 0.0] name:"features" parent:$icarus_data
    point cross:off centermarker:on pos:[-19.175293, -16.955243, -57.679239] name:"pt1" parent:$features
    point cross:off centermarker:on pos:[-10.061372, -17.098501, -53.991619] name:"pt2" parent:$features
    point cross:off centermarker:on pos:[-4.873158, -16.824249, -52.736154] name:"pt3" parent:$features
    point cross:off centermarker:on pos:[-3.206455, -15.929962, -53.503555] name:"pt4" parent:$features
    point cross:off centermarker:on pos:[6.199334, -14.134776, -43.799964] name:"pt5" parent:$features
    point cross:off centermarker:on pos:[13.221847, -12.823235, -40.588890] name:"pt6" parent:$features
    point cross:off centermarker:on pos:[-15.722660, -16.120689, -56.933798] name:"pt7" parent:$features
    point cross:off centermarker:on pos:[-10.581445, -15.710615, -54.533461] name:"pt8" parent:$features
    point cross:off centermarker:on pos:[-4.985870, -15.421799, -55.125434] name:"pt9" parent:$features
    point cross:off centermarker:on pos:[3.267875, -11.454979, -48.744023] name:"pt10" parent:$features
    point cross:off centermarker:on pos:[7.835743, -13.183847, -43.209421] name:"pt11" parent:$features
    point cross:off centermarker:on pos:[12.416473, -11.951571, -41.220784] name:"pt12" parent:$features
    point cross:off centermarker:on pos:[18.815018, -9.933573, -39.237343] name:"pt13" parent:$features
    etc
    etc
    etc
    Kind Regards,
    Richard Birket
    ----------------------------------->
    http://www.blinkimage.com

    ----------------------------------->

  • #2
    Beware. Usually the difference between y-up or z-up coordinate systems is NOT simply swapping the axis. I dont know for icarus but usually your best bet is to use a pre-factored transformation matrix to convert between the two. Tho using a matrix seems "daunting" at first it is definately less error prone!

    To go from y-up to z-up here's the correct transformation matrix that also takes rotation and scale into account correctly:
    zUp = someYupVectorOrMatrix * matrix3 [1,0,0] [0,0,-1] [0,1,0] [0,0,0]

    Regards,
    Thorsten

    Comment


    • #3
      Thanks. Blimey, that does seem daunting, especially to someone who is as useless with scripts as me (no joke!).

      Without appearing tooooo thick, what exactly do I do with that matrix?
      Kind Regards,
      Richard Birket
      ----------------------------------->
      http://www.blinkimage.com

      ----------------------------------->

      Comment


      • #4
        Okay. The line i posted actually is a scriptline. You multiply a transformation matrix or vector with that matrix and this fixes the transforms to be zUp.

        zUp = someYupVectorOrMatrix * matrix3 [1,0,0] [0,0,-1] [0,1,0] [0,0,0]

        someYupVectorOrMatrix could be your camera's matrix for example. So you could step through each frame in the current timerange and multiply the camera's current transformation matrix with the given one (matrix3 [1,0,0] [0,0,-1] [0,1,0] [0,0,0]). Or better for each key in case there are subframe keys or alike.

        Regards,
        Thorsten

        Comment


        • #5
          Thanks again, but I still don't really understand. I have 1 camera, 1077 points and the timeline is 691 frames.

          Where do I 'apply' this scriptline, or do I just add it to the top of the script that Icarus generated (the sample lines above are from that script)?

          Again, I must apologise for my ignorance of all things 'maxscript'.
          Kind Regards,
          Richard Birket
          ----------------------------------->
          http://www.blinkimage.com

          ----------------------------------->

          Comment

          Working...
          X