I have asked a question over a the App Hub, but not had any responses so I thought I’d ask the gurus here.
Is it possible to get the model to display its texture rather than the greyscale that this project outputs?
The code can be found on this site.

EDIT
I have uploaded the source code here, because I still can’t get this to work correctly. Can someone please help?
I just took a quick look at the shader code and as I had suspected the pixel shader does not use any sort of texture,
As you can see a texture is not being refrenced, the diffuse is being calculated as a combination of various other variables.
This was almost certainly done to reduce the complexity of the code, however adding support for textures should be fairly trivial. You should take a look at the pixel and vertex shaders at the bottom of this sample to see how textures can be used in shaders and integrate that with the CalcLighting() function.
You’ll need to set the models texture yourself in code for the shader to see it. I cant remember the exact syntax but something like this:
Is what you’re looking for, where “texture_name” is the name of the type texture you have declared in the shader file.
Another thing you’ll need to consider is re-writing the parameters CalcLighting takes in, you will need to pass the texture coordinates from the vertex shader and you can probably remove vDiffuseAlbedo as that can be replaced by the colour of the texture.
Unfortunately I can’t make this answer any more thorough without actually writing code (and I have no access to an XNA install currently), consider these pointers and try and find a tutorial for loading a textured model using shaders. Since you seem to be interested in using custom shaders avoid tutorials talking about BasicEffect as BasicEffect hides pretty much all relevant shader code from you and you won’t learn anything.
It’s hard for me to suggest tutorials you could learn from since there are so many tutorials online and each strikes someone elses fancy. So keeping in mind what i’ve said feel free to find a tutorial you’re comfortable with which explains how to load and properly render a textured model, then using that knowledge apply it to this sample. It’s really not as hard as it may seem at first!
Just did a quick’n’dirty modification to the sample code for you, it should work well enough to demonstrate texture mapping in shaders,
I added a texture variable to model.fx which I set through code so that it draws the texture instead of the white colour and I made sure the vertex shader passed the texture coordinates of the vertex to the pixel shader. keep in mind I deliberately broke the lighting calculation to simplify the purpouse of the texture sampler.
And using one of your samples in the ‘DefferedShadowMaps.cs’ source file in the ‘DrawMainLightingPass’ I modified some of the draw code to be as follows:
Please note this is not the way you should handle model drawing and management but it is the most straightforward way I could demonstrate you to texture your model. This works (I ran it and it was fine), so feel free to modify it and make it suited for your own engine design 🙂