Jump to content
  • Advertisement
Sign in to follow this  
QNAN

Problem with road and normalmap

This topic is 2304 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 have been working on roads based on splines, when I encountered a problem, where the normalmap messed up the result, based on the orientation of the road.

When I run a straight road from south to north, it looks quite normal, but when I run the same road from north to south, the road looks as if it has alot of specular value on its material, although that is not the case.
All variables are the same otherwise, like the sun (there is only one lightsource in the scene, the directional light of the sun).

It looks like this:

road_normalmap_woes.jpg


Normally when you put an object in the scene, it will come with a world matrix, through which the light direction will be transformed. That does not happen with my road, and my guess is, that that is the problem. With a winding road, there can be no single matrix for the entire road anyway. So my guess is, that this has to be solved through the calculated tangents, but I don't know if that is true, or how to do it.

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
That's correct. Most normalmaps represent normals in tangentspace, not in worldspace or objectspace.

For the road, you have already calculated either the tangent or bitangent - that's the extrusion vector from one side of the road to the other.
The other of the 2 is more or less the cross product of that + the up vector. Edited by Digitalfragment

Share this post


Link to post
Share on other sites
It turned out that I was using a normalmap, that behaved like that. I finally tested (after excluding everything else, including my entire shader code, argh!) another normalmap, which did not have this problem.
I apologize for the trouble.

Thanks for the reply, Digital, it helped me on my way, by excluding that I had made errors in my tangent calculations.

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!