2
\$\begingroup\$

I created a model (real simple) in 3DSMax 2010, exported it to FBX format and loaded it in an XNA 4.0 content project. I also tried with .X files using kW X-port and it has the same behavior.

I can load the model in a game, and it has it's 3DSMax texture. I can't however change the texture of a face (or all) at runtime. When I do this, it doesn't crash or anything, it just doesn't apply the textures.

I've tried with a sample model from a microsoft creative tutorial (the famous spaceship one) and on that model, with my texture, it works. This is why I think my model isn't working properly.

Anyone care to comment/help?

Note: Even though I don't think the problem is there since I've made it work with another model, here is my LoadContent method to load the model and change the texture of all mesh :

protected override void LoadContent()
{
    base.LoadContent();

    ContentManager contentManager = new ContentManager(Game.Services, "Content");

    Model = (Model)contentManager.Load<Model>(ModelName);
    Texture = (Texture2D)contentManager.Load<Texture2D>(TextureName);

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.Texture = Texture;
        }
    }
}
\$\endgroup\$
2
  • \$\begingroup\$ It would be easier to help you if we could download the model you are using. \$\endgroup\$ Dec 15, 2011 at 5:35
  • \$\begingroup\$ Here is a link to the model I made : mediafire.com/?13gz8570miwwa41 \$\endgroup\$
    – Tipx
    Dec 15, 2011 at 13:40

1 Answer 1

2
\$\begingroup\$

Ok, so yes the problem is in your model. You haven't set:

  1. UVW mapping for your geometry

  2. A diffuse map for your material.

In 3ds max, when you use the Standard material on your model and change the Diffuse Color the material doesn't actually have a texture, and so it doesn't use one even if you give it one later.

Basically, here are the steps to make it work (sorry if you don't need such a specific list, but I'll make it usable by anyone):

  1. Make the diffuse color of your material grey.

  2. Click the little box next to the diffuse channel to give it a map, and choose bitmap.

  3. Navigate to your initial texture.

  4. Choose it.

  5. UVW map your geometry, there are so many tutorials about this on the internet that it's pointless to put one here.

  6. Export it again, and, depending on the exporter, choose 'Copy textures to output' or the equivalent.

If you do all of this it should work, as I've made it work on my computer

\$\endgroup\$
2
  • \$\begingroup\$ Thanks!!! I still have a lot of work to do before I can call myself anything else than "atrociously bad", but this really helped me out! \$\endgroup\$
    – Tipx
    Dec 16, 2011 at 4:00
  • \$\begingroup\$ Everyone starts somewhere, you'll be answering questions like this in no time \$\endgroup\$ Dec 16, 2011 at 4:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .