CMOD structure
Posted: 25.09.2012, 14:50
I would like to rotate a single mesh (through 45 degrees) in a CMOD model.
Obviously, if I could convert the CMOD and make the modification in for example Anim8tor, that would be the easiest way to approach it.
But, as far as I know, there's no tools out there to convert CMOD's into 3ds or any other format that can be loaded into a modelling tool. (The only tool I'm aware of that loads CMOD's is Chris' cmodview utility).
(If anyone knows of a [ CMOD -> other modelling format ] conversion utility, then please let me know, and the remainder of this post will then become moot. )
Assuming there is no such tool, then that option's not available.
So, as it's such a simple transformation, I thought I would tackle it by editing the ascii CMOD directly and applying a little simple trigonometry to selected vertices.
There's quite a good Backus Naur description of the CMOD structure here: http://www.lns.cornell.edu/~seb/celestia/cmod_format.html, however, it doesn't document exactly what the eight values of each vertex represents.
All it has on this aspect is:
(I'm assuming that we're dealing with a -1 to +1 normalized 3D space and that the X,Y,Z coordinates of each vertex is represented by at least 3 of those values. )
The question I have though, is:
Which of the eight values represents the X, Y, and Z positions respectively? Here's the very simple example used in that WIKI page:
In order to do the transform, I need to know which values represent which axis.
If I want to rotate in the Z-axis (X-Y plane) then I only need to modify the X and Y values, if in the X-axis, then only the Y-Z values are modified,.. etc...
(I'm assuming that I won't have to make any changes to the trilists.)
Can anyone elaborate on the definitions of these 8 attributes? (and incidentally, why are there 8, rather than just 3?.. what do the other 5 represent?)
Cheers
CC
Obviously, if I could convert the CMOD and make the modification in for example Anim8tor, that would be the easiest way to approach it.
But, as far as I know, there's no tools out there to convert CMOD's into 3ds or any other format that can be loaded into a modelling tool. (The only tool I'm aware of that loads CMOD's is Chris' cmodview utility).
(If anyone knows of a [ CMOD -> other modelling format ] conversion utility, then please let me know, and the remainder of this post will then become moot. )
Assuming there is no such tool, then that option's not available.
So, as it's such a simple transformation, I thought I would tackle it by editing the ascii CMOD directly and applying a little simple trigonometry to selected vertices.
There's quite a good Backus Naur description of the CMOD structure here: http://www.lns.cornell.edu/~seb/celestia/cmod_format.html, however, it doesn't document exactly what the eight values of each vertex represents.
All it has on this aspect is:
Code: Select all
<vertex_pool> ::= vertices <count>
{ <float> }
(I'm assuming that we're dealing with a -1 to +1 normalized 3D space and that the X,Y,Z coordinates of each vertex is represented by at least 3 of those values. )
The question I have though, is:
Which of the eight values represents the X, Y, and Z positions respectively? Here's the very simple example used in that WIKI page:
Code: Select all
mesh
vertexdesc
position f3
normal f3
texcoord0 f2
end_vertexdesc
vertices 6
0 0 0 0 0 1 0 0
1 1 0 0 0 1 1 1
0 1 0 0 0 1 0 1
0 1 0 0 0 -1 0 1
1 1 0 0 0 -1 1 1
0 0 0 0 0 -1 0 0
trilist 0 3
0 1 2
trilist 1 3
3 4 5
end_mesh
In order to do the transform, I need to know which values represent which axis.
If I want to rotate in the Z-axis (X-Y plane) then I only need to modify the X and Y values, if in the X-axis, then only the Y-Z values are modified,.. etc...
(I'm assuming that I won't have to make any changes to the trilists.)
Can anyone elaborate on the definitions of these 8 attributes? (and incidentally, why are there 8, rather than just 3?.. what do the other 5 represent?)
Cheers
CC