In this article, I will assume that you have at least knowledge of
matrix.pdf in which are some fundamental facts.
This is yet to be compleatly understand, I am pretty sure that this is not exactly trash, since it is based on at least 300 changes of field files. It was pretty nasty, as you can imagine, first divide sections of field file, load section 2 into hexedit, change byte, save section 2, run .bat file that complete new field file with new section 2 and compress it. After that I always had to use ficedula lgp tools, awfull, I am definitelly going to program commnad line program for this, in gui i had to alway on original field file, click, replace, click instead of just adding line to .bat file. After that run ff7.exe, go to destinated location and observe what happend.
I am working on program to load walkmesh along with cameramatrix. I am pretty sure about vectors, after all, they are all same lenght and they are ortogonal, but i could misinterpret order of them, position of center is little uncertain and resize facotor too. The program shoud help me to figure out these thing.
Description of section 2 (field file) - camera
============================
Goal of this section is to define cameramatrix. In fact it seems pretty simple. For cameramatrix, you need vector for axis x, vector for axis y, vector for axis z and position of camera in worldspace. Vectors for axis x,y,z are defined in worldspace and in cameraspca are normaly united.
Example> you have axis x defined as vector (0.176,-0.512,0.840) but thats in the worldspace, in cameraspace it is just (1,0,0)
* Every every offset is here relative, 00 is at the start of section 2 (after lenght indicator).
* Every pice of code or article about somthing to do with 3d I ever wrote or write was, is and will be in left handed coordinated system= x axis from left to right, y axis from bottom to top, z axis from near to far.
* In here, I am changing signs so these vectors should be correct for file loaded right from section 5-walkmesh. While in walkmesh you dont change any signs, here i am changing them, so they will fit and if you use this article with unchanged values for walkmesh, you should get right image , same as in ff7. (FIXME: not yet true)
How to get vectors for axis:
Vectors are stored right at the beginning of sec2.
typedef struct {
S16 x;
S16 y;
S16 z;
} vector3s;
You will load first vector for axis x (from offset 0 to 5), for axis y(6 to 11) and axis z (12-17). These values are in fixed point with multiply constant 4096. Lenght of vectors x,y and z is always 4096 (more or less see
here(first vecsize is for x, then y and last z)), thats make out multiplication constant. These vectors are also always ortognormal, as you can see in ORTO 1-2 (1=x,2-y,3=z) ORTO U-Vis scalar product of U and V. As you can see, very near zero (first value is without division of multi constant).
Now you have three vectors, but they are not looking in correct direction, you have to change some signs. For each vector change sign of y and z values. Now these vectors should point in correct direction, same as in ff7.
I am now supppose that you have vectors for axises loaded, each component of each vector was divided by 4096 (dont forget to store it in float) and you changed signs for component y and z.
After vectors is one S16 number (from offset 18 to 19), same as z component of vector for z axis.
Now you want to have position of center of cameramatrix. Get three S32 numbers for position of center (x from 20 to 23, y from 24-27 and z from 28-31). These number are not position of center in worldspace, but they are position of center of cameraspce, defined in space, where position of center is in 0,0,0 and axis for vectors are the ones you read, but have opposite signs. If you didnt understood doesnt matter. You get center of cameramatrix like this:
// vx,vy,vz are axis you read, divided, y,z signs changed
// (tx,ty,tz) is position of cameramatrix in worldspace
// ox,oy,oz ire S32 nimbers you read from offset 20 to 31
tx = -(ox*vx.x + oy*vy.x + oz*vz.x);
ty = -(ox*vx.y + oy*vy.y + oz*vz.y);
tz = -(ox*vx.z + oy*vy.z + oz*vz.z);
After this is just blank U32 number, seems always zero and last, but not least resize number (36-37) (dont know wheather Signed or Unsigned). The bigger resize number is, the bigger is the model and walkmesh.
EDIT
I think we've been trying to find that darned walkmesh for the last four years! I would *REALLY* like for that to be found, along with the camera location, camera range, and floor triggers. That's really the only thing stopping us from having a halfway decent field "player"
OK Now I have delivered walkmesh and camera. Well, camera need some more work, but it is more or less 80% complete. Along with research on camera I am doing section 6, there are gateways (little red triangles), places which change location. I already know how to change destination, and few other things. What did you mean by floor triggers?
EDIT2OK, something is terribly wrong,program is working but axis are not aligned=walkmesh, but I am SURE that thay are axis, so I will try every combination of axis and signes or somethink like that.
BTW this is slight modifed program I made to university, it has animated chocobo in the middle, own texturizing functions for polygons, mad pipeline, clipping in cameraspace and lots of other features, like permissions, I will be very simple to modify it for walkmesh, since already now it has function that dont allow chocobo to cross sime lines created by polygons I defined.