Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / understanding a .x file

Author
Message
slicer 4 ever
19
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 1st Jun 2007 22:53
i posted this in the3 dimensional section of the forum but no one responded so i'll try here:

ok i understand most of the .x file however i'm unsure of the following part:


FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}

i know it's talks about rotating the object and movement which is what i need however i'm unsure of the order so can someone put it in terms like:

? = i'm unsure of what could go there

FrameTransformMatrix {
x, y, z, ?,
xrot, yrot, zrot, ?,
?, ?, ?, ?,
?, ?, ?, ?;;
}

my smiles love me =-)=-)=-)(-=(-=(-=
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Jun 2007 04:08
Hallo Emoties ...I have proven to make some changes in the values of the numbers, and it really works, but no one know (not me)... how you could control the real values at any moment...

when we open an x. file, we can change textures and things like that, but we can not change x,y z as you try, because that is not code to compile....it is a hard work trying to handle the data but sometimes we do it just for fun....Good luck..!!

oh my god
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 2nd Jun 2007 04:19 Edited at: 2nd Jun 2007 19:04
Hello s4e,

In an x file, the FrameTransformMatrix template is used for two things basically, it defines the location, scale, and orientation intially of a mesh (3d object):

The template is often in the form:

Frame {
FrameTransformMatrix {
}
Mesh {
<various mesh info>
}
}

and the second thing, is it uses AnimationKeys to transform the object over a series of interpolated frames based on a series of key frames.

So far maybe this sounds a bit like mumbo jumbo, but it's not too tricky. It helps to understand what is happening if you know a little vector and matrix math.

The animation keys give the clearest example. Basically, animation in the x file is identified by a number that represents it's type. If you are talking DBC (direct x 7) then there are 3 types, position, scale, and rotation (orientation). From direct x 8.1 (and DBPro) and on there is a fourth type, matrix transformation which is specific to vertex rotation-manipulation or bone animation, skin meshing, blah blah blah. For DBC, we can't even use the fourth so we'll only worry about the 3.

The matrix that you displayed:

1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;

is called an identity matrix because it has that series of diagonal 1s and all the other values are zero. Basically, this type of matrix means that what ever coordinates, vectors, or other matrices you put into it, you are going to get the same thing back out of it - i.e., it's not going to change anything.

Let's say you changed the matrix to look like:
2, 0, 0, 0
0, 2, 0, 0
0, 0, 2, 0
0, 0, 0, 1

This means you are now scaling whatever you put into the matrix by two. So if you had coordinates of (10,0,5), they would be scaled to (20,0,10)

Now what about:
1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
2, 2, 2, 1

This means that what ever coordinates are put into the matrix will be translated by (2,2,2). So (10,0,5) becomes (12,2,7). To understand all of the details of how these nubers are changing, you have to know some basic matrix math. So I will summarize what the matrices are for various states:




Now like I said, the FrameTransformMatrix is used for two things, for intial position,scale, and orientation of a mesh, and for animation. When the animation keyframes are fed through the FrameTransformMatrix (FTM), they are transformed according to the matrices I've shown above. If the FTM is the identity matrix, then the animation keys won't be transformed then interpolated, they will just be interpolated by the direct x application (in this case DarkBASIC). Without a FTM, there can be no animation - the animationkeys in a direct x file specifically reference a Frame template which contains an FTM which in turn references mesh information. (may want to research if a missing FTM would prohibit animation - some apps might generate one automatically if it isn't present in the x file)

One thing I should mention, the rotation key in the Animation section of a direct x file is represented by quaternions. That's why it has 4 values - that's another topic in and of itself.

Enjoy your day.
slicer 4 ever
19
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 2nd Jun 2007 05:20
@latch
thanks i understand it now also i may ask another question on animation later so thanks and especially thanks for being very detailed

my smiles love me =-)=-)=-)(-=(-=(-=
Anto
20
Years of Service
User Offline
Joined: 30th Oct 2005
Location: Brisbane, AUS
Posted: 6th Jun 2007 14:06
G'day

Just wondering, is there any format that can use to do animation in DBC? Like .3ds?

Anto
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Jun 2007 17:25


.X is the main format for DBC. .3ds is secondary.

Enjoy your day.

Login to post a reply

Server time is: 2026-07-05 22:37:21
Your offset time is: 2026-07-05 22:37:21