2
\$\begingroup\$

I'm getting this error while trying to load a model in XNA 4.0 : Error 2 The mesh "transform1", using SkinnedEffect, contains geometry that is missing texture coordinates for channel 0. The model was dxf format then I upload it to maya then I added some skeleton and some texture (viewed it on the UV) but I still get this error.

enter image description here

this is the load function.

    protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("myModel");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["Take 001"];

        animationPlayer.StartClip(clip);
    }

this is the draw function :

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice device = graphics.GraphicsDevice;

        device.Clear(Color.CornflowerBlue);

        Matrix[] bones = animationPlayer.GetSkinTransforms();

        // Compute camera matrices.
        Matrix view = Matrix.CreateTranslation(0, -40, 0) * // x, y, z
                      Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) * //rotate y
                      Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) * //rotate x
                      Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance), 
                                          new Vector3(0, 0, 0), Vector3.Up);

        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                device.Viewport.AspectRatio,
                                                                1,
                                                                10000);


        // Render the skinned mesh.
        foreach (ModelMesh mesh in currentModel.Meshes)
        {
            foreach (SkinnedEffect effect in mesh.Effects)
            {
                effect.SetBoneTransforms(bones);

                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();

                effect.SpecularColor = new Vector3(0.25f);
                effect.SpecularPower = 16;

            }

            mesh.Draw();
        }

        base.Draw(gameTime);
    }

PS : 1-My knowledge with Maya & XNA is very limited cause I used to use OpenGL/C++ for some time.

2-Also I change my Content Processor to SkinnedModelProcessor not Model - XNA Framework. thanks in advance.

\$\endgroup\$
1
\$\begingroup\$

The error is clear. One of your meshes/vertices is missing a texture coordinate, which is the expectation in this case. In Maya, apply a texture channel to transform1 mesh even if you have no intentions of assigning any textures to it.

Also, why do you have a mesh called "transform"? Are you sure you didn't mistakenly misname a bone as mesh or vice versa?

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ I'll try this out, sorry it wasn't my model and didn't check the name. thanks . \$\endgroup\$ – AbdelRahman Badr Dec 2 '14 at 18:48
  • \$\begingroup\$ Thanks very much, I did the mapping and changed the name and everything is great, also sorry if the question was repetitive or dumb. \$\endgroup\$ – AbdelRahman Badr Dec 4 '14 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.