This project is read-only.

Drawing a model on a marker with v3.0

Oct 20, 2009 at 11:49 AM
Edited Oct 20, 2009 at 11:54 AM

Hi, I have a problem about drawing models.

I am trying to draw 'p1_wedge'(in totorials sample fbx model) on groundMarker.

I don't know how to make it.

----------------------------------

 private void CreateObjects()
        {
            groundMarkerNode = new MarkerNode(scene.MarkerTracker, "ground");
            scene.RootNode.AddChild(groundMarkerNode);

            // Loads a textured model of a ship
            ModelLoader loader = new ModelLoader();
            Model shipModel = (Model)loader.Load("", "p1_wedge");

            // Create a geometry node of a loaded ship model
            GeometryNode shipNode = new GeometryNode("Ship");
            shipNode.Model = shipModel;
            // This ship model has material definitions in the model file, so instead
            // of creating a material node for this ship model, we simply use its internal materials
            shipNode.Model.UseInternalMaterials = true;

            // Create a transform node to define the transformation for the ship
            TransformNode shipTransNode = new TransformNode();
            shipTransNode.Translation = new Vector3(0, 5, -12);
            shipTransNode.Scale = new Vector3(0.002f, 0.002f, 0.002f); // It's huge!
            shipTransNode.Rotation = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0),
                MathHelper.ToRadians(90));

            //shipTransParentNode = new TransformNode();
            //shipTransParentNode.Translation = Vector3.Zero;

            // Now add the above nodes to the scene graph in appropriate order
            //scene.RootNode.AddChild(shipTransParentNode);
            //shipTransParentNode.AddChild(shipTransNode);
            //shipTransNode.AddChild(shipNode);

            groundMarkerNode.AddChild(shipTransNode);
            shipTransNode.AddChild(shipNode);
        }

 

------------------------------------------------

This is the method I am using.

What should I fix it??

Please help me~

Coordinator
Oct 21, 2009 at 4:26 AM

The code snippet looks fine.

My questions are:

Is your marker tracking ARTag? If you're using ALVAL, the parameter you're passing to marker node.

Are you creating a ground geometric node that is attached on to your groundMarkerNode and acts as an occluder?

If so, since you're shifting the model (0, 5, -12) relative to the marker's (0, 0, 0) coordinate location, it'll appear below (-12 below the marker surface) the ground geometric model attached to the ground marker node, and the occlusion hides it.

Also when you place things on marker node, you need to know exactly the size of the marker. For example, if the marker size is 4x4, and your scaled model is 100x100x100, then you won't see anything because you're inside of the model and the rendering uses backface culling. If the marker size is 100x100, and your scaled model is 4x4x4, then it'll appear very small and again, you won't be able to or very hard to see it.

Hope this helps

Ohan

Coordinator
Oct 21, 2009 at 4:27 AM

Are you using v3.0 or v3.3? Note that 3.3 is the latest version.

Ohan