Log in or register to post comments

How to display 2d image when FrameMarkers is detected.

February 13, 2013 - 8:35pm #1

I'm developer on iOS(FrameMarkers). I would like to display 2D picture(JPG) or 3D model in each FrameMarker.For example  FM1 shows 3D ,FM2 shows 2D, FM3 shows 2D. Now I can display only 3D model but I don't know how to display 2D picture. Do Anyone know how to solve this problem or adapt code from sample?

How to display 2d image when FrameMarkers is detected.

April 14, 2016 - 7:40pm #7

This is exactly what I would like to know, i.e. how to add 2D image/texture when a frame marker is recognised. I have asked this question here: https://developer.vuforia.com/forum/ios/dynamic-image-not-rendered-correctly-ipad

The problem I'm facing is that if I add a 3D Plane game object in Unity Editor at design time my image is rendered correctly when deployed to iPad. If I add 3D Plane game object programmatically at run-time, then when deployed to iPad it is rendered as pink/magenta rectangle. Of course it works in Unity Player.

My question what is the difference between Plane and Quad? Would it make any difference to my problem?

 

How to display 2d image when FrameMarkers is detected.

February 15, 2013 - 1:20am #6

OK, that is pretty easy to do:

first, you need to render a "quad" instead of the classic "teapot"; the texture of your picture is applied on the quad; you can find the full code to render a textured quad in the VideoPlayback sample for instance (see the quadVertices, quadNormals, quadTexCoords variables and how they are used in the OpenGL code)

second, you will need to adjust the pose matrix so that it behaves like a Billboard, i.e. by resetting (clearing) the rotational part of the matrix and only keeping the translational one; in practice this can be done with this simple code:

QCAR::Matrix44F modelViewMatrix =
            QCAR::Tool::convertPose2GLMatrix(result->getPose());

        // reset the rotational part of the pose matrix
        modelViewMatrix.data[0] = 1.0f;
        modelViewMatrix.data[1] = 0.0f;
        modelViewMatrix.data[2] = 0.0f;
        modelViewMatrix.data[3] = 0.0f;
        modelViewMatrix.data[4] = 0.0f;
        modelViewMatrix.data[5] = 1.0f;
        modelViewMatrix.data[6] = 0.0f;
        modelViewMatrix.data[7] = 0.0f;
        modelViewMatrix.data[8] = 0.0f;
        modelViewMatrix.data[9] = 0.0f;
        modelViewMatrix.data[10] = 1.0f;
        modelViewMatrix.data[11] = 0.0f;

This should do the trick.

 

How to display 2d image when FrameMarkers is detected.

February 14, 2013 - 7:29pm #5

2D picture move with the marker. How can I do that

How to display 2d image when FrameMarkers is detected.

February 14, 2013 - 1:31am #4

OK. Just for confirmation: should the 2D picture move with the marker, or do you want to just show it statically in the center of the screen when the marker is detected?

How to display 2d image when FrameMarkers is detected.

February 14, 2013 - 12:38am #3

I mean "screen-aligned", showing the 2D picture instead of 3D model.

How to display 2d image when FrameMarkers is detected.

February 13, 2013 - 10:55pm #2

Hi, do you want to render the 2D picture as a billboard (i.e. a "screen-aligned" object, positioned in 3D on your marker, but aligned with the screen) or as a 3D surface aligned with the Marker plane ?

 

Log in or register to post comments