A working LScript Plugin has been finished...
DOWNLOAD CURRENT VERSION
http://www.pcgamemods.com/8120/
http://www.geocities.com/rich_is_bored/ ... Export.zip
Original Thread:
Okay, to get the ball rolling on a means to export MD5cameras from Lightwave, I'm creating this thread.
First and foremost, contrary to popular belief, I am not a programmer. I took a class on Turbo Pascal in high school 6 years ago but that's about the extent of my programming knowledge.
I've got a copy of Dev-C++ and I've been toying with it so if it's absolutely nessecary I can write a program to do the conversion but, I'll be frank, it's going to suck and it's going to be a DOS mode program at best.
Now, on to the idea...
In another thread I mentioned the possibility of converting saved motion paths (*.mot) to MD5camera format. Both file formats are plain text and that should make the conversion fairly easy.
The first thing is to decypher the formats. So, on that note, here is what I believe the MD5 camera format is comprised of...
Code:
MD5Version 10 // Header and Version
commandline "" // Command Line Parameters - Used to convert maya format
numFrames 452 // The Number of Frames
frameRate 24 // The Framerate
numCuts 3 // The Number of Cuts
cuts { // A List of Frames Where Cuts Take Place
110
329
429
}
camera { // A List of Key Frames
( -908.6940917969 -3417.0383300781 552.0170898438 ) ( -0.0069773775 0.0820536837 -0.084440738 ) 54.4321250916
... // The format for each line is as follows...
continues on // (X_POS, Y_POS, Z_POS) (HEADING, PITCH, BANK) FOV
...
( -903.4814453125 -3417.0383300781 555.6039428711 ) ( -0.0068133976 0.0792509392 -0.0853850618 ) 54.4321250916
}
So, the values that an MD5camera needs ...
- Number of Frames
- Framerate
- Number of Cuts
- List of Cut Frames
- List of Frames
- Position on the X axis
- Position on the Y axis
- Position on the Z axis
- Rotation for Heading
- Rotation for Pitch
- Rotation for Bank
- Field of View
Now, here is what I believe the MOT motion file format is comprised of...
Code:
LWMO
3
NumChannels 6
Channel 0 // X channel
{ Envelope
1 // Number of keys in this channel
Key 1 0 0 0 0 0 0 0 0 // Keys (Value, Time, Incoming Curve, Tension, Continuity, Bias, NA, NA, NA)
Behaviors 1 1 // Pre and Post Behavior (0-Reset, 1-Constant, 2-Repeat, 3-Oscillate, 4-Offset Repeat, 5-Linear)
}
Channel 1 // Y channel
{ Envelope
1
Key 2 0 0 0 0 0 0 0 0
Behaviors 1 1
}
Channel 2 // Z channel
{ Envelope
1
Key 3 0 0 0 0 0 0 0 0
Behaviors 1 1
}
Channel 3 // Heading channel
{ Envelope
1
Key 0.06981317 0 0 0 0 0 0 0 0
Behaviors 1 1
}
Channel 4 // Pitch Channel
{ Envelope
1
Key 0.08726646 0 0 0 0 0 0 0 0
Behaviors 1 1
}
Channel 5 // Bank Channel
{ Envelope
1
Key 0.10471975 0 0 0 0 0 0 0 0
Behaviors 1 1
}
So, the values that an MOT gives us either directly or can be calculated easily ...
- Number of Frames
- List of Key Frames
- Position on the X axis
- Position on the Y axis
- Position on the Z axis
- Rotation for Heading
- Rotation for Pitch
- Rotation for Bank
Now if you compare the two you'll see that there are a couple problems.
There is no list of cuts, there is no FOV channel, and Lightwave interpolates between key frames where an MD5camera lists each frame in sequence.
You could force users to bake key frames in the graph editor. This would create the missing frames and make it easier to convert because all the calculation is already done.
The alternative isn't pretty. In order to do this manually you'd have to calculate the values for a given frame based on the curve type, tension, continuity, and bias.
Not to mention I don't know what those last three values are for and if they play a role.
As far as the cuts and FOV go, that may be do able. Is it possible to add new channels to an object in Lightwave? If so, do they get saved in a motion file?
If not, then perhaps we can use one or more of the extra fields in a MOT to fudge it if we force users to bake key frames.
The alternative is to ask the user for input and that's going to be a problem for some users.
Anyway, this is just me spilling my guts. Let's see where this goes from here.