Jump to content

  • Log In with Google      Sign In   
  • Create Account

Problem with road and normalmap


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 31 May 2012 - 10:47 AM

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:

Posted Image


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.

Sponsor:

#2 Digitalfragment   Members   -  Reputation: 848

Like
1Likes
Like

Posted 31 May 2012 - 08:14 PM

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, 31 May 2012 - 08:14 PM.


#3 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 02 June 2012 - 05:15 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS