Aractain Aractain

Tangents generation and you. Is it important? (updated with some RESULTS! incudes new pictures)

Tangents generation and you. Is it important? (updated with some RESULTS! incudes new pictures)

So do you care about the direction of tangents? I mean from all the XSI ships I've seen all the tangents are facing generaly the same way with some variation but I can't really determine why they are like that.

I understand XSI's interface for creating tangents but I have no idea how they determine the inital direction in the first place. It certianly seems to work for ships in game.

 

Anyone have better insight into this, and ultimatly does it matter what direction they are as long as it looks okay?

 

I'll see if I can russle up a screen shot to illustrate what I mean...

 

This ship should be obvious, the red lines are the tangents.

 

 

 

The reason I ask is because I can't think of a useful way to get a result like that (and im not even sure what is 'best'). I can make them all face one way or get some horrible averageness or have them per vert (which dosn't seem like a good idea).

22,039 views 43 replies
Reply #26 Top

I still have NO idea why the sins ships seem to have tangents that look like the very first picture while I thought your supposed to use the UV (of a special tangent map) which make them look like the second picture.

 

Im also wondering if there is any use for the vertex colour value in the .mesh file (unrelated but whatever).

 

I've got the above maps to a state im happy with, which is nice. Now I have to try and finish the rest of the script.

Reply #27 Top

I just wanted to check in and see how the script is going Aractain.  It would be an immense help for those of us who use Max and haven't yet taken the time to learn XSI. 

Reply #28 Top

Slight feature creep - I try and do something, learn a better way to do it... realise what I could do with what I just learened - try to do it, learn a better way...

I can't see much else I want to do/can do now though, its cleaning it up and testing it to do mostly.

Reply #29 Top

As far as creating the tangents for SoA 2 i have just been following the modding documents. I only "re-mapped" tangents for two ships i built which are the Ambassasdor, and the excelsior. With results similar to your "wrong" advent battleship, because two mesh components are mapped to the same UV hence the different color. The models i made the tangents for have the least issues in game.

The 3rd party models are another story. Most of those models use many "mirrored components, and use 1/2 mapped areas. In other words they UV-ed half a saucer then mirrored the other half. The Galaxy, and Defiant in SoA 2 are glaring examples of this. The only way i can tangent those models is by doing a top down planiar tangent map. Anything else makes the models look much worse than what they already do. I already resigned to the fact that the meshes have to be re-built, and re-UV-mapped to fix the issue. However if you can find a better way. You will make this modeler one happy person.

Reply #30 Top

Well, it's not only a pitty for you max users. I'm using XSI for tangents, and have another winderful "bug"

I've made tangents for the sharlin for the b5 mod which look fine in XSI! Ingame the lightning looks awesome, but the light is coming from the wrong direction. with the star shining at the front of the sharlin, the light is rendered as if coming from the right (user perspective)

Reply #31 Top

Light direction is defined by normals not tangents I think. A screen shot would probably help. :P

Reply #32 Top

It could be normals, but to be honest I can't think of a way this could happen based on my own experience.  I've only had them flipped, which just turns the texturing/lighting inside out in-game.  You might check their directions to make sure each Normal is pointing in a direction perpindicular to the face of the polygon it's associated with.

I'm only just learning XSI tangent mapping myself (so no guarantees here), but you might try mirroring or flipping (is there a difference?) the entire tangent map on whichever axis is your front to back.  Just a near-random thought.

 

 

 

Reply #33 Top

I had a silly bug which fliped normals (these are per vertex). The triangle normal (the thing your talking about) is based upong the winding order.

I had part of the model light up when it was facing away from the star and vice versa.

(I fixed the bug incedently)

Reply #34 Top

Oh?  That could be something I've had an issue with before but just not realized it.  When I work in max all I see are the normals that extend from each vertex.  What's the difference between what you refer to as the vertex normals and the triangle normal?

Reply #35 Top

the vertex normals are responsible for smoothing they tell the lighting engine how much light to use based on the angle between the light source and the vertex normal. (And then its interpolated between the verts based on distance I think).

Vertex normals are derived from face normals by adding the face normals and divding by the number of faces (well I use a mid point) (and you would know if you fliped the faces in max).

Triangle normal is based on the winding order of verts. If a face is made up from points 1,2,3 the flipped version is 3,2,1.

 

I think it would be unlikely to have an issue with this.

 

Reply #36 Top

Edit:  After experimenting with it I see exactly what you mean.  I achieved the reverse lighting effect by selecting all normals and rotating them 180 degrees about any 1 of the axes. 

So, does the triangle normal just take each separate polygon and flip the Normals' orientation of all three axes?

 

 

Reply #37 Top

Quoting Mystic, reply 36
Edit:  After experimenting with it I see exactly what you mean.  I achieved the reverse lighting effect by selecting all normals and rotating them 180 degrees about any 1 of the axes. 

So, does the triangle normal just take each separate polygon and flip the Normals' orientation of all three axes?

 

 

 

Im not really sure what you mean but my best guess is how a triangle (which is a polygon) is flipped.

If so, no it dosn't do that, it would work but that isn't how it works.

Heres how:

edge 1 is vert 2 - vert 1 (i.e. three position values minus indavidually minus the other three so you get a 3 number result, a vector)

edge 2 is vert 3 - vert 1

polygon normal is edge 1 cross edge 2 which gives you a vector

if you flip the first and last values in the vert order you alter the vectors that go into the cross product operation and it prodcues the opposite vector.

 

(i think, im not great at maths)

Reply #38 Top

@Aractain
I'm not sure that would help, since it is not exactly flipped but 90 degrees off. Thats what amazes me. It still looks wonderful, just not correct.

Reply #39 Top

Is it possible you changed the normals in XSI? I don't use it so im not sure if thats even possible. I also don't know how the convert XSI .exe actually works. How much it calculates and how much it just rips from XSi.

 

Just an idea, I doubt anyone has really been affected by this odd normals stuff.

Reply #40 Top

No, I did not modify the normals... I really have no idea how this happened. Haven't seen such a thing before. As for the workings of convertXSI, i think it just converts them and does not calculate, but I'm not sure.

Either way, the model still looks wonderful so I think for nor I have to live with the lightning being a bit off. Thanks for the input though.

Reply #41 Top

Quoting Aractain, reply 31
Light direction is defined by normals not tangents I think. A screen shot would probably help.

Here, a screenshot of the sharlin and his normals...

They are the surface normal ( normalized one ), the vertex normal are from the type "angle weighted Vertex normal"... surface normal are important for the lightning but the vertex normal are important for the shadow... angle weighted vertex normal allow a more "gradient" effect on the shadow else shadow are identical for any point on a poly... tangent are more important for the reflection and act on the shadow too ( no tangent make shadow jump from poly to poly )

These model was made in the same way that previous one... so, i don't understand that light are coming from the wrong way... render in lightwave, poser 7 pro, Wings3D, ArtOfIllussion and a few other 3D software, using raytracing,  are ok...

For these who have interest, meshlab is a great tool ( open source ) for check and correct any mesh... http://meshlab.sourceforge.net/

Reply #42 Top

I have just completed a model that I just could'nt get the tangent colors to match. No matter which way you orientate them some of the polygons don't have the the colors in them that others do, unless I made them all black. Which after many hours of almost completely fruitless research, I'm pretty sure your not supposed to do. They should be either green, blue or red. Now after hours and hours of trying to get my model all 1 color or close to it with gradual shifts in color, a flow on, so to speak. I just gave up in the end, I was just chasing my tail ending up back where I started, so finished off the model converted it put in the game and tried to pick the miss match's.

Well I might be getting a bit old but I can't see any anomilies. The only thing I could find was a bit of seam striaght up the middle which I'm pretty sure is a result of symtrizing.

screen

here's the color map in softimage

tangents

Although my tangents are obviously not real good. I can't see anything that really wrecks the model. So I am sort of thinking that the polygon colors don't have to be that well matched. I could be wrong but I think its alright as long as you have red, green or blue in the apropriate places and even then it doesn't matter that much.

One thing I wish, as far as SoftImage is concerned, is that there was more info about it in the user guide, tutorials or anywhere. I can't seem to find anything that really explains what exactly is needed.

Edit; Oh! I forgot to mention. @TobyWahn_Kenobi, This is a long shot but could your lighting problem happen if you had your Aura & Above nulls about face / upside down?

Reply #43 Top

Quoting SuperZERO0, reply 42


Edit; Oh! I forgot to mention. @TobyWahn_Kenobi, This is a long shot but could your lighting problem happen if you had your Aura & Above nulls about face / upside down?

 

No, thanks for the input. As a matter of facz, after I ported the mod to Diplomacy and started a test run, the lightning now seems ok. Wether it was the change to diplomacy or just the fact that the game was now completely new from scratch I don't know. Just happy it works!