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.

UPDATE: It is apparently the BasicEffect that is the culprit here. I tried to use another effect (which I coded myself) and then it works!?!? )I kinda like the EnableDefaultLighting, though...)

So this question is now rephrased to: "what in the model exported by Blender can cause BasicEffect to fail to render the texture?".

I have imported this model into Blender and exported it to an .fbx file and imported it into my XNA project. The problem is that the model is pitch black (just as it is in Blender when I look at it in object mode) when drawn in XNA. I have verified that the texture really is there (and that only one iteration is made):

       foreach (var mesh in _model.Meshes)
            foreach (var part in mesh.MeshParts)
                if (part.Effect is BasicEffect)
                {
                    var be = part.Effect as BasicEffect;
                    using ( var stream = File.Create(@"c:\test.jpg") )
                        be.Texture.SaveAsJpeg(stream,2048,2048);
                }

I have followed exactly the same procedure with other models and it has worked. Since the model looks good in Blender and the textures really makes it into XNA... what can be wrong here?

For what it's worth: one difference from what I'm used to is that these textures are not stored inside the .fbx but in a separate subfolder, but the XNA content importer finds them (I get an error if I try to remove them).

UPDATE: it may be important to mention that this model actually has three textures: diffuse, specular and normal maps. However, ONE of them should be projected by the BasicEffect, right?

UPDATE: a screen shot from Blender.

enter image description here

share|improve this question
    
Are you setting any lighting values to your model? –  r2d2rigo Feb 23 '12 at 10:44
    
Yes, I have just swapped in this model in place of another model which works great. –  danbystrom Feb 23 '12 at 10:52
1  
Did you check the normals in blender? (While in edit-mode press N to bring up the transform-panel, scroll down to "Normals" and enable "Face" normals. That way you'll see if normals point in the right direction. Otherwise you might want to do a "Recalculate normals"). –  bummzack Feb 23 '12 at 12:19
    
The normals are there, I'm afraid. Thank's for the tip, though! –  danbystrom Feb 23 '12 at 12:30
add comment

1 Answer 1

I would guess that the problems is with the UV mapping.

Is your texture mapping in blender set to UV with the correct map?

When blender export FBX it uses the txt version of FBX (not the binary one). Try to open open the FBX file in a text editor to see if something looks wierd (if the UVs or Normals are all zeros)

share|improve this answer
    
Nothing strikes me as odd... wouldn't notice if something is missing - but no large amounts of repeated zeros. I have uploaded a screen shot from Blender. Note that in object mode the model is pitch black. That may be a clue? :s –  danbystrom Feb 23 '12 at 14:48
    
@danbystrom I just opened that model in Blender. It's black, beacuse the "diffuse" color of the material is set to black. So most likely your textures aren't being imported and the model just shows with its default diffuse color? –  bummzack Feb 23 '12 at 14:58
    
Well... as I wrote - the effect is clearly "seeing" a texture of size 2048x2048 - which is correct... I'll have to copy it out and look if it is black or not! Thanks! –  danbystrom Feb 23 '12 at 15:01
    
No. :-( It is saving out the diffuse map. –  danbystrom Feb 23 '12 at 15:16
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.