3D object registration in ARToolkit

hi…
I’m learning building AR with ARToolkit library. I conducted some observation from the sourcecode provided by this library, let’s say simpletest. and then in draw function I changed the translation value of z axis from 25.0 to 0.0 (original: glTranslatef(0.0, 0.0, 25.0) to glTranslatef(0.0, 0.0, 0.0)). when I did this, I found out that the cube I rendered as if “running” as I rotated my marker along x axis. Meanwhile using the original, it does not “running” when I rotated the marker. Can anyone explain why it was that?

glTranslatef(0.0, 0.0, 0.0)) yields

http://i48.tinypic.com/2803f4.jpg

original: glTranslatef(0.0, 0.0, 25.0) yields

http://i50.tinypic.com/2hi8j1e.jpg

thanks :slight_smile:

[QUOTE=Dedyariansyah;1236746]hi…
when I did this, I found out that the cube I rendered as if “running” as I rotated my marker along x axis[/QUOTE]
I think before anyone can answer you you need to explain what you mean better. The pictures you posted do not tell me anything about your ‘problem’.

[QUOTE=BionicBytes;1236814] The pictures you posted do not tell me anything about your ‘problem’.[/QUOTE].

well, I put an ellipse to the picture so that it can be distinguished.

first picture

I did not change source code from ARToolkit where argument from the function glTranslatef(0.0, 0.0, 25.0), it translates the object 25 unit in z direction so that when I rotated my marker the object remains in fixed position and do not move across the pattern.

but when I changed the value of glTranslatef(0.0, 0.0, 0.0), it moves across the pattern when I rotated the marker.

my questions, why we must translate the object at certain value, so that it stays in fixed position (do not cross the pattern as the marker rotate)?
secondly, can we block partially or fully the virtual object rendered with real object? or in other words, the virtual object is behind the real object?

thank you…

It sounds like the origin 0,0,0 in ARtoolkit is at the center of the marker. It means That if you draw a cube, you have to take it in account. So a cube centered on 0,0,0 will appear to be wrong for the part that intersects the real world marker, unless you shift it away, ‘out’ of the marker.

To appear to block virtual objects with real ones, you have to fill the depth buffer with virtual data matching the real world. Example, draw first a quad the size of the marker, with blending and totally transparent. Its color will not be visible, but it will still occlude other objects rendered after.