Jump to content
  • Advertisement
Sign in to follow this  

MDX hlsl-effect ranomly rendering wrong

This topic is 4071 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've made a game with mdx which is using a couple of hlsl-effects. One of these is a normalmap-effect that some times works fine but some times it looks realy strange, can't realy explain how it looks and it's hard to get a screenshot of it. Anyway, I've tried to render only the normalmap without any lightning or diffuse colors just like a simple texture and it works fine, if i transform the normalmap into tangent-space for the vertex, only the faces that faces up will get the correct(from the normalmap transformed into tangentspace) normals, all other faces will become totaly yellow, blue or green(normal from the vertex, not from the normalmap). The code for getting the normalmap looks like this:
    output.tangentToWorld[0] = normalize(mul(input.tangent, World));
    output.tangentToWorld[1] = normalize(mul(input.binormal, World));
    output.tangentToWorld[2] = normalize(mul(input.normal, World));   
float4 normalFromMap = 2*tex2D(NormalMapSampler, scaledTexCoord)-1;
//return normalFromMap; works fine here, just like a normal texutre
normalFromMap.xyz = mul(normalFromMap.xyz, input.tangentToWorld);					
//return normalFromMap; here will return a correct normalmap for faces facing up, other faces will get their flat vertex-normal
normalFromMap.xyz = normalize(normalFromMap.xyz);
I know this probably isn't enough info for anyone to help, especialy since the code above sometimes works! I havn't got a slightest idea where else it can be wrong, everything else looks just like it should. I've tried my game on four computers and got the effect above to work on two of them. On the computers i got it to work on i sometimes also get the corrupted normalmap, but simply switching anistrotopic filtering on or off in catalyst control center makes the game run normaly, it doesn't matter if you switch AF on or off, as long as you switch it the game will work. (Don't ask me how i figured that out :S) I have to do this every time i restart the computer or return from hibernate/standby. On the third computer i get the same looks as on the two computers above when it doesn't work, only difference is that you can't fix it by switching anistrotopic filtering on or off. :( All computers above use radeon cards, I have tried with both catalyst 7.4 and 6.10 and it's the same problem with both versions.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!