Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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;
        }
    }
}
share|improve this question
    
It would be easier to help you if we could download the model you are using. –  annonymously Dec 15 '11 at 5:35
    
Here is a link to the model I made : mediafire.com/?13gz8570miwwa41 –  Tipx Dec 15 '11 at 13:40
add comment

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
    
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! –  Tipx Dec 16 '11 at 4:00
    
Everyone starts somewhere, you'll be answering questions like this in no time –  annonymously Dec 16 '11 at 4:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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