Tangent vectors and UVs

disanti

15-07-2007 08:54:52

Hello,

I've 3d modeled a massive twisty turny self-intersecting cave level for my game, and found that the best way to UV map it was to use the 3ds max per-face UV mapping. Unfortunately, I soon found out that tangents generated from the UV coordinates are terribly ugly. I tested this by re-UV mapping with the box setting which gives me perfect tangents but nasty seams in my cave.

I'd like to know if there is a way to easily/quickly fix the UV coordinates on my cave so that it will export proper tangent vectors?

I programmed a small tool to take the second set of UVs from a mesh and use those to generate tangents while retaining the original UVs, but it didn't work. :x

So my options are re-UV map the entire cave manually (trying to avoid that at any and all costs), or find a way around this entirely.

Any suggestions would be great. This cave is an extremely complex mesh that I'm trying to repeat a texture over without any seams at all. I wish there was a way to tell max to just follow the tunnel and UV map that way but of course no one is going to program that, ever. :wink:

Thanks.

p.s. I didn't know exactly where to post this, but since I'm exporting with oFusion, I'm guessing this area is appropriate?

Lioric

16-07-2007 16:56:28

If you post some screenshots of your object probably any hints or tips can be suggested

disanti

23-07-2007 02:07:10

Sorry for the delayed response, but here is a screenshot of the problem:


Notice the seams on the texture caused by normal mapping. Without the normal mapping there are no seams. Do you have any ideas as to what could be causing this?

Evak

23-07-2007 04:43:27

hmm, this looks a lot like the problem I was having with normal mapped shaders and smoothing. The only way I could get around it in my scene was to meshsmooth the offending mesh an extra itteration then the smoothing worked as expected.

http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=4912

disanti

23-07-2007 05:04:08

It already has one mesh smooth iteration, so I tried exporting it with 2 iterations and it just made the seamed faces smaller... they're still there. :?
Anything else I can try?

Lioric

24-07-2007 02:38:18

How are you generating the tangent vectors and the binormals?

disanti

24-07-2007 02:49:07

Really, I'm not sure. I'm just checking the boxes "Generate Tangents" in oFusion's exporter. :wink:

With the tool I made to "fix" the tangents uses this line of code to generate them:
mesh->buildTangentVectors(Ogre::VES_TANGENT, 1, 0);

Lioric

24-07-2007 02:55:47

It seems your shader uses the TANGENT Buffer for the tangent vectors, and the produced meshes will generate the tangents in a TEXCOORD buffer, if this is the case you need to modify your shader to use the TEXCOORD buffer stream

disanti

24-07-2007 03:07:46

I'm using the Monster shader from the Ogre Wiki, and I've exported mesh from oFusion before and had them work fine with it. Am I right in saying that oFusion exports the tangents to the TANGENT buffer? I'm not using the mesh that was "fixed" by my tool as that just seemed to make the problem worse. Thanks.