FlarToolkit made easy : SimplAR
As cool as bell-bottom pants according to Keith Peters! Which is pretty damn cool. And it can be really fiddly setting up the FLARToolkit, so I’ve finally released some of my AR code. Just in time for it to go out of fashion.
It uses the Alchemy branch of the FLARToolkit and includes everything you need to get up and running. It also has a very optimised automatic threshold adjustment system that takes virtually no extra processor time.
Here’s a quick intro :
It’s easy to use, there’s just one class. And I’ve also included swc files for the FLARToolkit Alchemy branch and the latest revision of Papervision2.1. You just need to extend the class and override the add3DObjects function.
package ly.seb.simplarexamples { import ly.seb.simplar.SimplarBase; import org.papervision3d.objects.primitives.Sphere; [SWF (width="640", height="480", backgroundColor="0x000000",frameRate="30")] public class AR_Sphere extends SimplarBase { override public function initialise() : void { var sphere : Sphere = new Sphere(null, 40); sphere.rotationX = 90; sphere.z = -50; //add it into the container that is updated //relative to the pattern marker container.addChild(sphere); } } }
Check out the screencast below to see how to use a custom marker, handle when the pattern is lost and found, and load a 3D model in.
You can check out the project from my googlecode repository at : http://code.google.com/p/sebleedelisle/
There area couple of extra things I’d like to add to the code, at the moment the size is fixed at 640×480 and the image is not mirrored; both things I would like to fix in the future.
I’d like to thank thesven.com for his FLARToolkit Alchemy code that saved me masses of time! Thanks also to Jesse Freeman and Kyle Kellogg for helping me test this.
Related posts:
- Papervision "billboard" particles
- Papervision interactive Line3D
- Papervision Perspective Line material
- Changing a cube's material dynamically in Papervision3D
- Memory leaks in Papervision3D patched up!
Tags: AR, FLARToolkit, SimplAR

Wait, this is using alchemy? I assumed you can’t mix that w/ as code?
.V
ps: after taking your class, I wrote this:
http://code.google.com/p/realapi/source/browse/trunk/workspace.examples/htpc/src/htpc2/HTPCApp.as
Hey Vic! Yeah you can just point to the Alchemy generated swc file from your FlashBuilder project and have access to all the C classes.
[...] FlarToolkit made easy : SimplAR | Seb Lee-Delisle [...]
[...] Tutorials / Guides « FlarToolkit made easy : SimplAR [...]
Very neat. Downloading as we speak.
One question, though. Does the toolkit allow for multiple markers running at the same time?
Hi Andreas,
that’s currently a limitation with the Alchemy branch of the FLARToolkit – you can only work with one marker at a time (at least it was last time I checked!). If you need multiple markers you’ll need to set up the “normal” FLARToolkit code base.
cheers!
Seb
Hi,
First of all a lot of thaks for the lynda.com training videos, I am the premier member of lynda.com. I working on AR project I need to create application with FLARtoolkit. In application I have to create some kind of interactivity with the 3D object and also need to create a menu with active buttons. When click on the button object will do some thing. I am really confused about how can I achieve this. Please give me some advice to get my project done. I will be really thankful to you.
Usman
Hi Usman, can you pass all technical requests regarding the Lynda.com training through the Lynda site, please? Use the Support>contact us>Technical Support(Content) link. Cheers!
Thanx for ur reply, I am not asking anything regarding lynda.com I just want you to give me some direction to start and finish my project. I know it is not appropriate but if you can then I will be thankful to u.
Usman
Hi Seb – I’ve been able to run your source in FB4, but I’m having difficulty importing a custom .dae file… I’ve tried exporting in Maya, Modo, and Blender (both DAE 1.4 and 1.3.1), but I ended up getting just the default box.
Also tried importing your torusknot to those programs and re-exporting… Resultant = still default box o.O …
Are there specific conditions needed for the dae file?
Which program did you use to create the torusknot?
Hi Yos, Sounds like your project isn’t set up properly. There are full instructions on the second video above, and the examples provided show you exactly how to load models.
cheers
Seb
Hi Seb, I did actually go through the examples in the second video before posting – I was able to run all of your examples in Flash Builder 4, but I just couldn’t load in a custom dae (this was simply putting in the dae in the bin-debug/asset folder and changing the filename of the .dae file mentioned in the dae example). I think it might be due to collada export version – but there seems a dearth of documentation on importing collada files to papervision. Anyhow – which program did you use to model your torus?
Hi Seb! Got the custom model to import (apparently it was too small – blew it up about 1000x and now it’s visible) … next step would be figuring out how to include the same model with fancy materials (looks like only diffuse is showing – what about specular, etc) – any advice?
How do you deploy the SimplAR Flash Builder project to .swf on a web server? (bin-release .swf’s don’t seem to work outside of bin-debug)
You can publish to an HTML file in the build settings. And you’ll find more help on Papervision3D DAEs in general on my lynda.com course. http://www.lynda.com/home/DisplayCourse.aspx?lpk2=61220
cheers!
The Lynda course is beyond my budget for this weekend project, but I’m wondering if what I’m trying to do is beyond what’s possible in Papervision3D/Flash 3D.
Since image data is fed in from the webcam, is it possible for the virtual object to be semi-transparent? All the examples I’ve seen so far involve opague- objects.
So, the object I’m trying to import is a glass jar of water. Rather than just baking down textures, I’d like to make it look realistic, with semitransparency and all – just like a glass jar of stuff ought to look.
Here’s a render http://posterous.com/getfile/files.posterous.com/ina-zntvj/8jDvFxEtEMvu80vrrgiarCpMoF4Ltjgj8ChE76IrNjakc3eGKCjqYmxebct3/testbottle2.png
Also, in other news, on setting the “generate html wrappers” checkbox in “actionscript compiler”, the .swf loaded in the browser shows up as a black screen, still! I get the prompt for webcam box on both, but I’m only able to get image from the webcam when I double click the .swf to run it by itself [not in the browser]