Troubleshooting this TutorialSometimes, even though you try hard to understand the information in a tutorial, things don't work out quite like you want it to. This page is here to help you resolve any problems you might be having with the tutorial on creating a bump map shader. The Common Mistakes section describes common problems that people have when doing the things in this tutorial, and how to resolve them. The Frequently Asked Questions section describes questions that people have that aren't related to mistakes, but rather, trying to understand the stuff better or exploring how it can be used. If your problem or concern isn't addressed here, feel free to add a comment below, so that I know where you're having trouble. I like to keep these pages fairly clean, so I may remove comments that I felt like have been addressed. If I remove your comment and you don't feel like the problem has been fixed, repost the question and we'll take another look at it. If a tutorial has a mistake in it, I will fix the mistake and reply to the comment with a brief explanation. However, after a couple of weeks I'll likely go back and remove the original comment as well as my reply, because, hopefully, the problem will have been fixed, and it won't be a concern any more. |
Common MistakesNone listed yet… |
Frequently Asked QuestionsNone listed yet… |
I've followed your tutorial but I simply can't get it to work. All the previous shader tutorials have worked perfectly but this one doesn't.
There's no errors or anything, but the bumps just don't appear. I'm using XNA 3.1, and since this tutorial is over a year old i suspect it might be written for an older version of XNA? Maybe that has something to do with it.
I even tried copy your shader code right off, but that doesn't help either. I am using my own camera system, not the one you made for these tutorials, so I don't know if that has anything to do with it. But I don't think so, since the previous tutorials work.
There could also be something wrong with my model. I made it myself in Wings 3D but I have no skills in 3D modeling so I could have messed something up there. The texture looks fine on it however, and I don't see anything wrong with the heightmap or normal map I made. The bumps just don't appear.
Any ideas of what could be wrong?
Thanks.
I spent some time with it and got it to work. I had not provided a complete sampleāI had to go and gather all of the pieces and put them together. Anyway, if you go back and look at the tutorial, at the top of the page (either of the two pages) there is now a link to a .zip file containing a working example.
I have not yet tested this on the Xbox, and if that is what you are doing, that may be the problem, because there are sometimes few minor differences between the Xbox shader code and the Windows shader code, although I don't think that there should be any problems with this shader in particular.
This tutorial was designed for XNA 3.1 and Visual C# Express 2008, which is what I used to create the demo code.
I probably need more information about the problem to really know how to solve it, so please let me know if you are still struggling with it.
Other than that, the first place you might want to look is to make sure you are assigning all of the shader's variables (parameters) correctly. From what you described, it may be that you aren't ever sending over the bump map to the shader.
Anyway, let me know if that solves the problem or not. I'd be happy to keep helping if it still isn't working!
Thanks for the quick reply!
I forgot to mention that I'm only doing it on Windows, I don't care about Xbox.
Anyway, I took a look at the example you uploaded and for some reason that one doesn't work for me either. It runs fine without errors but the bumps just don't appear.
I uploaded a picture that shows what the helicopter looks like to me: Helicopter, and I haven't changed anything in your code.
So there's obviously something wrong on my end, but I don't know what it could be. I have a Radeon HD 4890 and I tried updating the graphics drivers, but that didn't help.
Do you have any idea what could be causing this?
I'm also having this problem :( Both my own project and the one for your zip file look exactly like the image posted by poe. I have a Radeon HD 4600, hmm, coincidence or no?
I think my problem is a little different. In XNA 4.0, all of the previous shaders are working, but not this one. When I attempt to run the program I get :
The current vertex declaration does not include all the elements required by the current vertex shader. Tangent0 is missing.
I assume it's talking about my input:
struct VertexShaderInput
{
float4 Position : POSITION0;
float3 Normal : NORMAL0;
float3 Tangent : TANGENT0;
float3 Binormal : BINORMAL0;
float2 TextureCoordinate : TEXCOORD0;
};
But I'm unsure how to pass in the missing tangent parameter.
I'm having the exact same problem as you, and also sith XNA 4.0, so i think it's a change from xna 3.1 to 4.0 maybe, havent found the answer yet:(
The way I do it is to get XNA to generate tangents for me. If you select your model the solution explorer, and then look at it's properties you will see the property Content Processor. Expand that property and make sure Generate Tangent Frames is set to True. For this to work, the model must have texture coordinates for all mesh parts. This worked for me, hopefully works for you too.
Thanks i've abanoded this project because this problem but if only i'd known the solution is so close.. thanks again, have a nice one!
Thank you, I was having that issue and changing that property solved this for me too! :D
Post preview:
Close preview