XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Skinned Model with multiple UV texture maps

Last post 07/11/2009 6:43 by Goss. 4 replies.
  • 06/11/2009 7:42

    Skinned Model with multiple UV texture maps

    I have a .fbx file I exported from Maya which contains animations and 3 texture files. However, I can only get the first texture to render.
                     Texture2D[] mTextureArray = new Texture2D[3]; 
                TextureArray[0] = Engine.Game.Content.Load<Texture2D>("texture1"); 
                TextureArray[1] = Engine.Game.Content.Load<Texture2D>("texture2"); 
                TextureArray[2] = Engine.Game.Content.Load<Texture2D>("texture3");         
     
            protected override void DrawModel() 
            { 
                //Skinned Model Processor 
                Matrix[] bones = mClipPlayer.GetSkinTransforms(); 
     
                Matrix[] transforms = new Matrix[Model.Bones.Count]; 
                Model.CopyAbsoluteBoneTransformsTo(transforms); 
                Matrix world = transforms[Model.Meshes[0].ParentBone.Index]; 
     
                foreach (ModelMesh mesh in Model.Meshes) 
                { 
                    for (int i = 0; i < mesh.Effects.Count; i++ ) 
                    { 
                        Effect effect = mesh.Effects[i]; 
                        effect.CurrentTechnique = effect.Techniques["MainEffect"]; 
     
                        effect.Parameters["Texture"].SetValue(mTextureArray[i]); 
                        effect.Parameters["Bones"].SetValue(bones); 
                        effect.Parameters["World"].SetValue(world); 
                        effect.Parameters["View"].SetValue(Camera.View);                  
                        effect.Parameters["Projection"].SetValue(Camera.Projection);             
                    } 
                    mesh.Draw(); 
                } 
            } 

  • 06/11/2009 16:30 In reply to

    Re: Skinned Model with multiple UV texture maps

    I don't really understand what you are trying to do here. How many different effects do you have on this model? If you debug this code, how many meshes, effects, etc, are actually present?

    You don't normally need to load textures separately from the model at all: if you map them onto the right parts of the model in Maya, that data will be exported to the FBX file, so the model will be loaded with the right textures already set onto the appropriate effects.
    XNA Framework Developer - blog - homepage
  • 06/11/2009 19:35 In reply to

    Re: Skinned Model with multiple UV texture maps

    I tried that and the fbx only loads the first texture.
  • 06/11/2009 19:50 In reply to

    Re: Skinned Model with multiple UV texture maps

    I would look at how you are applying these textures in the modeling program, then.
    XNA Framework Developer - blog - homepage
  • 07/11/2009 6:43 In reply to

    Re: Skinned Model with multiple UV texture maps

    Thanks Shawn. I will talk to the artists about it.
Page 1 of 1 (5 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG