I've been going through several tutorials on how to use XNA and understand a lot thus far. I've got a screen, I've got 2D sprites working, got a shader system operational, so far so good. Now I've hit a wall.

I'm attempting to load a 3D model (FBX Format) I've exported from 3DS. My issue, is the texture system. First, I'm trying to avoid embedding the textures directly into the FBX as I'll be reusing a lot of the textures for different things, no need to load multiple copies of the same texture. I know my texture, even though not embedded, is making it to my XNA classes because I can see it inside the FBX (when saved as ASCII) and get a compiler error if I attempt to move the texture out of its original location. I can also see it compiling the image during a rebuild.

However, if I attempt to render the object, no texture. Loading code:

protected override void LoadContent()
    objModel = LoadModel("Models/OriginModel");

objModel is defined as a Model higher up in the cs file.

My display code:

foreach (ModelMesh mesh in objModel.Meshes)
    foreach (Effect currentEffect in mesh.Effects)
        currentEffect.CurrentTechnique = currentEffect.Techniques["TextureNormalMap"];
        currentEffect.Parameters["World"].SetValue(objTransforms[mesh.ParentBone.Index] * worldMatrix);

I've stripped out the matrix transforms and such as they're not causing the issue. TextureNormalMap is my shader I've written that displays a texture with a normal map. This generates a black model. If I however add...

metalTex = Content.Load<Texture2D>("Textures/brushedmetaltexture");



where needed, I get the texture to display. This is of course, the problem. I have to include the texture in my Content system, causing the image to be compiled twice (which generates a warning..compiled once from the FBX, compiled once from Content). More importantly, I would have to hand-texture all the models again inside the XNA system in order to get them to display, which is what I'm trying to avoid. I've already textured them once in 3DS, do I really need to specify, inside XNA during object load, all the textures again?

So, any ideas on what I'm doing wrong here? What magical step am I skipping? Am I supposed to, somehow, figure out what the texture name is from the FBX file itself and get a pointer to the extracted image to feed into my Texture2D? Is there a different object I should use that includes the texture from the FBX? Do I need to bite the bullet and just go with embedding (which still doesn't work with the above code btw)?

I've been going off of tutorials as I mentioned, but this step seems to be missing, or am I just being daft? I apologize if this seems trivial, but I just can't solve it. Is there some step in the object loading process I'm missing?


1 Answer 1


I think the name of the texture in the FBX file is what gets assigned to the effect parameter. So if it's not set to "ColorMap", it won't work.

I personally use a custom content processor that allows me to change the texture, effect file, and whatever else right in the Visual Studio properties window. Check this function to see how I set the texture. "DiffuseTexture" is the name of my effect parameter.

If you poke around the code there's a lot of other support for my cobbled-together Blender->FBX->XNA pipeline. It even supports multiple animation takes imported from a single FBX file. I don't recommend it to anyone, but if you've already made the mistake of going down that road, it might be useful.

  • \$\begingroup\$ I played with the effect parameter in the FX file, renamed it to DiffuseTexture, Material, Texture, and a dozen other items I found in the FBX file with no success. I'm exporting from 3DS, but as it's the same output format (FBX), that shouldn't matter, should it? \$\endgroup\$
    – AzHole
    Mar 25, 2013 at 18:07
  • \$\begingroup\$ It's probably somewhat different from Blender. I'm not as much help then. My advice is to try using a dummy content processor (similar to the one I linked to) but that doesn't really do anything. Then set a breakpoint and you can use the debugger to see what textures (if any) are being imported and what they're called. Note that regular breakpoints won't be hit in the content pipeline, you have to add a special function call (System.Diagnostics.Debugger.Break() I believe), and it will launch a debug prompt during the build. \$\endgroup\$
    – etodd
    Mar 25, 2013 at 19:03

You must log in to answer this question.

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