I'm creating a exporter script but I ran into a problem...

 My exporter script works It exports all mesh data and textures but I didn't understand what they mean't

about calculating the direction of a normal. Are they using a Pythagorean therom with the normal or is it just

calculated as usual but without normalizing it :|

 

1,617 views 4 replies
Reply #1 Top

Exporter from Sins Mesh to what? Wavefront obj.? Or something else?

If your looking to make a script for 3D max 1 has already been made.

The direction of normal's is associated, I believe, with which way the polygons face's is facing, outwards or inwards from the model. If a model is imported / exported with inverted normals, it will affect how components can be selected in some  programs(the ones that I am familiar with anyway). 

Also I think, but am not real sure, that if the model has inverted normals, the normal map's effects will appear reversed.

As far as how these normals are calculated I am not sure, I would think that there directional Coordinates are universal between programs & there is no calculations needed, the values are already there and conversion to a relevant convention is all that's needed. But there is a difference as to what different programs call the XYZ. Z in 1 program can be Y in another. As I mentioned I am not real sure about this, but that's my understanding, I could be completely wrong.

 

Reply #2 Top

If your looking to make a script for 3D max 1 has already been made.
End of quote

And another is nearly made... :P

 

You are mostly correct though super. Face normals come from the winding fo the face vertex indices. Vertex normals are midpointed face normals (of all those they touch).

Inverted vertex normals will result in reversed lighting. Inverted tangents result in reversed normal maps.

And yes max and sins use different handedness in their coordinates. Don't know about other packages.

 

 

Reply #3 Top

NumCachedVertexIndicesInDirection:<FRONT,BACK,LEFT,

RIGHT,UP,DOWN>

: These indice lists help the engine optimize a

number of operations (in particular weapons fire) and each list is

a sample of indices that reference vertices with normals that are

within some min angle of the direction indicated and are sorted by

distance to the origin of that direction. The origin of that direction

is defined as the unit normal vector of that direction * mesh radius

and the min angle is ((90 + 45) / 2) degrees.

Thats what the manual said.

So then do I calculate by adding the direction vector and the normal together to get some direction or

calculate 2 vertices to get the direction because there is no other way to get the direction of a vector without adding

another one.

Reply #4 Top

The direction of a vector IS the vector (from the origin, 0, 0, 0).

If you mean the direction origin, its the direction (1, 0, 0) multiplied by the mesh radius (which you need to calculate for the header anyway). That gives a position you can compare with each vert's postion to to get the cache order. (And the dot product gives you the angle difference of coruse).