What would cause textures to not load?

Dec 9, 2010 at 7:09 PM

Previously, I was loading a model as Model - XNA Framework with a custom effect and the content pipeline automatically loaded the effect

foreach (ModelMesh mesh in baseModel.Meshes)

{

foreach (ModelMeshPart p in mesh.MeshParts)

{

p.Effect = mesh.Effects[0];

...

and the diffuse, normal, and specular textures would automatically load. I've since changed the processor to use Model - XNAAnimation and the model shows up, but is greyscale. If I load the textures in the LoadContent() and then set the properties in my draw routine:

                    effect.DiffuseMapEnabled = true;
                    effect.DiffuseMap = DiffuseTexture;
                 //   effect.NormalMapEnabled = true;
                    effect.NormalMap = NormalTexture;
                    effect.SpecularMapEnabled = true;
                    effect.SpecularMap = SpecularTexture;
 
everything loads fine. But this means that I have to now take care of loading the textures and then checking which meshes need what textures and I'm trying to be lazy about this :o).
Your help is appreciated!! Thanks. 
Developer
Dec 9, 2010 at 7:13 PM

Are your "Texture Path/Texture Path Type" properties for the model correctly set in the Content project?

Dec 9, 2010 at 7:34 PM

Thanks for the reply: The textures are in the same folder as the model and the texture path is blank (empty). Is that right?

Developer
Dec 9, 2010 at 7:50 PM

Is your model correctly textured and exported from your 3D modelling software?

Dec 9, 2010 at 7:54 PM

When loaded with my custom effect it worked fine, so I am assuming the texturing is done fine (exporting is another matter). I noticed in my .x that the .JPG is specified under the effectparamstring for my old shader name. I wonder if I change the effect param string key value to be "specularmap" instead of "spec" for example if that would work...

Developer
Dec 9, 2010 at 7:58 PM

I am assuming you are using 3DS Max; you must set a basic material for the model, and the textures in the Diffuse, Specular and Normal channels.

Dec 12, 2010 at 6:34 PM

I am using MAX, thanks! Changing it as you've suggested seems to do the trick, although I'm not sure the normal map is loading correctly.

Out of the box I did NOT set the properties (DiffuseMapEnabled, NormalMapEnabled, and SpecularMapEnabled) and I get the specular highlight and everything okay, but it looks too smooth (like the normal map hasn't been applied). When I set the properties to true (especially after setting NormalMapEnabled) the model appears much more flat (like no specularity). Thoughts?

Thanks! 

Developer
Dec 12, 2010 at 7:38 PM

Is the normal map set in the "Bump" channel of the material in MAX?

Dec 13, 2010 at 1:49 PM

According to my modeler, the jpg is set in the Bump > Normal Bump channel of the material. Is this the right place? Thanks.

Developer
Dec 14, 2010 at 5:50 PM

It must be set in the Bump channel, but as a Bitmap instead of a Normal Bump.