FLARToolkit and Alternativa3D, anyone?

Shortly after FLARToolkit was married to Sandy, I arranged it a secret date with Alternativa3D. The date was quite fruitful, and in a week this baby was born:


This is modified “Ballance” game released by Alternativa3D team in november, with FLARToolkit used to control camera instead of mouse. Unfortunately, due to GPL2 section 2 clause B I cannot distribute stuff including both FLARToolkit and Alternativa3D for free, so no SWF for you to play with atm, sorry. But, if anyone is interested in sponsorship to enable this thing to go online, contact me.

On the technical side (aka “how the hell was it done”), bad news are that neither object transformation matrix nor camera projection matrix cannot be directly set in Alternativa3D, so we have to resort to mind-f@#king tricks to get it working, and the result is only approximate match. Good news are that this approximation is, obviously, good enough and useable. An example of what has to be done to make it work can be found here (I believe my single AS file does not contain FLARToolkit, and so I can distribute it, under whatever license I want).

29 Responses to “FLARToolkit and Alternativa3D, anyone?”


  1. 1 ljones April 17, 2009 at 05:25

    Very cool. I saw some cool things yesterday at GA Tech, and this Augmented Reality technology is going to be very cool when you add in mobile devices.

  2. 2 Splengy April 18, 2009 at 04:01

    hey there i just found you googling something. great work. i like it very much. great use of the marker position to physics relationship. cool little game. pac man, i see it comming allready.

  3. 3 thivy April 23, 2009 at 21:02

    hey im trying to do the same game except its with wiimote.

    Is there any way i can get the code from 4? it will make my life so easy :)

  4. 5 ericsoco May 5, 2009 at 22:19

    hey makc, i’d like to roll in support for other 3D engines into FLARManager. was taking a look at your SimpleTest.as, and i noticed that you translate a FLAR matrix into a new matrix for use with Alternativa3D, but then you manually set props on a Camera3D instance like rotationX, etc, rather than directly applying that matrix to an Object3D.

    why is this? is this an idiosyncrasy of Alternativa3D? i.e. is it not possible to just apply a matrix to an object like you can in PV3D / flash?

  5. 6 makc3d May 5, 2009 at 22:46

    unfortunately, in Alternativa3D transform matrix is read only.

  6. 7 mclelun May 19, 2009 at 10:45

    damn, this is so nice.

    Makc the great!

  7. 9 Badim May 22, 2009 at 23:41

    Hey, very nice demo. I like it =)
    How much you looking for sponsorship? if you like we can disscust it via icq(146558873) or skype(mr.Badim).

    если спонсора не нашел, пиши =) что-нибудь придумаем.

  8. 10 Franklin February 5, 2010 at 08:23

    very nice. esp like the transparency.

  9. 11 gavin November 14, 2010 at 08:18

    hey… great work on this.

    getting stuck into flarToolkit and Alternativa3D.

    Maybe you can explain more about the work around for the transform matrix being read only?

    I have my FLARTransMatResult picked up from my AR Marker…

    How do I get my Object3DContainer to react to this?

    thanks

    • 12 makc3d November 14, 2010 at 08:48

      although this post was made more than a year ago, when alternativa was still 5th version, I think “the work around” is pretty much the same today, you calculate approximate scales/rotations/translations from matrix values. try same bit of code; but keep in mind that things like axes signs and rotations order might have changed.

  10. 15 gavin November 14, 2010 at 18:13

    Ive been looking at the code but Im not sure where you are getting the FLARTransMatResult from the augmented marker?

    Ive been looking at your SimpleTest.as and have come up with the following to use flash.geom.matrix3d

    but its quiet right… and its seriously slow!

    if (detector.detectMarkerLite(raster, _threshold) && detector.getConfidence() > 0.5)
    {
    //Get the transfomration matrix for the current marker position
    this.detector.getTransformMatrix(flarTransMatResult);

    //create the 3d matrix
    var somePoints:Vector. = new Vector.();
    somePoints[0] = flarTransMatResult.m00; //ma
    somePoints[1] = flarTransMatResult.m01; //mb
    somePoints[2] = flarTransMatResult.m02; //mc
    somePoints[3] = flarTransMatResult.m03; //md

    somePoints[4] = flarTransMatResult.m10; //me
    somePoints[5] = flarTransMatResult.m11; //mf
    somePoints[6] = flarTransMatResult.m12; //mg
    somePoints[7] = flarTransMatResult.m13; //mh

    somePoints[8] = flarTransMatResult.m20;//MI
    somePoints[9] = flarTransMatResult.m21; //mj
    somePoints[10] = flarTransMatResult.m22; //mk
    somePoints[11] = flarTransMatResult.m23; //mL

    somePoints[12] = 0;
    somePoints[13] = 0;
    somePoints[14] = 0;
    somePoints[15] = 0;

    m = new Matrix3D(somePoints); //load in the matrix…

    //var obj:Object3D = rootContainer;
    var obj:Object3D = flarCamera3D;
    m.invert();

    // m is not scaled, but we shall calculate scales any way, just to be NaN-safe
    var sx:Number = Math.sqrt (m.rawData[0] * m.rawData[0] + m.rawData[4] * m.rawData[4] + m.rawData[8] * m.rawData[8]);
    var sy:Number = Math.sqrt (m.rawData[1] * m.rawData[1] + m.rawData[5] * m.rawData[5] + m.rawData[9] * m.rawData[9]);
    var sz:Number = Math.sqrt (m.rawData[2] * m.rawData[2] + m.rawData[6] * m.rawData[6] + m.rawData[10] * m.rawData[10]);

    var sinY:Number = m.rawData[8] / sx;
    if (-1 < sinY && sinY 0) ? -Math.PI / 2 : Math.PI / 2;
    obj.rotationX = 0;
    obj.rotationZ = Math.atan2 (-m.rawData[1], m..rawData[5]);
    }

    obj.x = m.rawData[3];
    obj.y = m.rawData[7];
    obj.z = m.rawData[11];

    }

    • 16 gavin November 14, 2010 at 18:14

      I meant to say its “not” quiet right…!

      • 17 makc3d November 14, 2010 at 18:59

        I see you already have found right bit of code and started playing around with it – from here to your end result it is supposed to be played in solo :) I can’t really help you here as long as we aren’t sitting in the same room. One thing I can say, your performance problem is not in this code.

  11. 18 dsirijus November 28, 2010 at 02:12

    Of course, none of these trix are neccessary in a3d7, since matrix has setter now, no?

  12. 20 Claudia April 4, 2011 at 23:56

    Hi! Great work you have here!
    I saw above that you calculate scales, even if m is not scaled. (That is, scaleX and scaleY are 1). Well, I was wondering… but how is the 3D object scaled anyway? Supposing I want to overlap a rectangle over the marker. How can I scale it?

    Thank you for your time!
    Claudia


  1. 1 transmote speaks… » FLARManager v0.5 (for FLARToolkit) Trackback on July 19, 2009 at 03:25
  2. 2 Adventures in Augmented Reality Trackback on November 18, 2010 at 02:03
  3. 3 FLARToolkit入门&提高相关链接 | 86AR Trackback on May 12, 2013 at 05:56

Ask a Question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Old stuff

April 2009
M T W T F S S
« Mar   May »
 12345
6789101112
13141516171819
20212223242526
27282930  

Oh, btw…


%d bloggers like this: