Tangent Space.

Hi.

My quest on bump-mapping has come to a dead end.

I have met the tanget space, and I do quite well understand what it is.

I can figure out how to generate good(well behaved) binormal/tangent vectors for my triangles…

Any hints or pointers to articles about the subject would be greatly appreciated.

Well, if you understand the concept of tangent-space, and you can generate appropriate tangent and binormal vectors, what’s the problem? At this point, it is just a matter of implementation.

Well, the thing that has me confused is the
fact that the tangent/binormal should be “well behaved”, as Cass Everitt calls it, on page 34 of his “Mathematics of per-pixel lighting” presentation.

I have seen a few examples that creates tangents/binormals, but they are all either spheres or quads, where it is easy to create well-behaving tangent/binormals.

I wanted to know how to make sure the tangent/binormal is wellbehaved, when creating them for an arbitrary mesh of triangles.

Doh.
In the first post where I write
“I can figure out…”,
should have been

“I CAN’T figure out.”

Essentially, you have to make sure, you your s and t coordinates are as continuous as possible. Remember that you are trying to interpolate a Differential equation.

So you want your s and t coordinates to vary in almost the same direction from vertices to vertices.

Anyway, The truth is, it depends on how your texture maps are setup for your your models.

If you look at the example Cass gave, the object in the texture is tightly pack and pieces are all over the place. So in this case, you will get section of your models where the s and t from adjacent will vary in very different directions, some times in completly opposite direction!!!

So, if you use a smoother texturing, like the texture map for Unreal characters, where you can pretty much wrap the texture around your object, you do not need to worry about that.

If you need to worry about it, then presentation talks about some technique, but I am not sure how to implement it.

The tangent space coordinate frame will be well behaved if it is created correctly by the artist.

Really this just means that you probably don’t want to much sheer on the coordinates and perhaps the derivative shouldn’t change too much from poly to poly.

Ideally the coordinate frame (consisting of the normal, tangent and binormal vectors) should from a nice right angled set of vectors, but this isn’t always what is modelled with the application of texture. The other issue is that when you average these across polygons, each polygon has fixed linear texture derivatives which change suddenly across the polygon boundary, this is unavoidable without subdivision. However to avoid shading discontinuities you need to to average the tangent and binormal vectors, just as you average the surface normal for ‘smooth’ shading. So you have the inevitable situation where depending on the change in texture derivative across facets, you get a slight mismatch between the tangent and binormal vectors and their respective texture derivatives. Keeping this ‘well behaved’ just means minimizing the deviation, which is done when you build the model.

Summary, worry about this when you create the content. Of course you still need to compute these vectors correctly.

Okay, thank you for the answers, that
clears things abit up.