PDA

View Full Version : Animations Sets in DX8?



Lorigosolo
05-07-2006, 09:23 PM
Hi guys!!

Yeah!! Another fellow Waver crying for help on the game development side of our beloved LW!!

I´m currently working in a game project that uses directx files and as we all know LW does not come with exporters to that format! I know that we have some plugins like the one from DStorm (:thumbsup: ), but there are some bugs and Lw is crashing a lot latelly!!

Well let´s cut to the chase and i will ask for :help:!!

Does LW or any of the plugins available let us make animations sets when exporting to Directx? If there is a way to do that i would really appreciate the help!!

This is what i need to do!! Have 4 animations (Walk, Run, Wave and Die), so i put all of them in the same scene, and then export the file to DX8!! The problem is that i would like to have Animations sets info in the .X file like Walk (Frames 0 to 40), Run (Frame 55 to 75), etc!! That info should go in the .X file, but i don´t know if i have to do that manually or there is a way to name them in Layout or when exporting the animations to DX?

Any insight or info where i could find an answer or material about directx and LW would be greattly appreciated!! :thumbsup:

Adrian Lopez
05-07-2006, 09:46 PM
What I'm planning to do for my own game is to create a plugin that exports individual animations from MotionMixer into my proprietary format. By using MotionMixer you can assign a name to each individual motion so that your plugin can export these motions by name.

Lamont
05-08-2006, 11:46 AM
Do all the animations in one take/scene. Give the programmer the frames they start and end on.

DX is very good for things like this. You can have the programmer compile seperate animations into his own format. Since DX is/can be ASCII, he can do whatever he wants to it.

Adrian Lopez
05-08-2006, 12:05 PM
Isn't that what Lorgiosolo is already doing? Assuming he's created his own export plugin, why go through the trouble of giving programmers a list of frames that they must assemble into separate animations when you can have your plugin export named animations from MotionMixer?

Lorigosolo
05-08-2006, 12:21 PM
Thanks guys for the replys!!

Lamont that is exactly what i would like to avoid, i would like to give the programmer the file with the sets already done!! And in the worst case scenario i could create the sets by hand using the DX ASCII and edit the files!! :)

I was using MotionMixer at the begining, but when i exported the scene to DirectX (using the exporter from D-Storm) the animations stored in MM were not exported as this plugin does not have that ability!

The idea Adrian gave seems to be the best solution to the problem i have!! So i will have to talk to the programmers in the team and see if anyone of them are up to do a plugin to export the MM data to DX format!! :) That could really save us some time!! Have you already done a plugin that does that Adrian?

Thanks a lot Adrian and Lamont for the help!! Really appreciate!! :)

Adrian Lopez
05-08-2006, 12:51 PM
Have you already done a plugin that does that Adrian?Not yet.

Lamont
05-08-2006, 01:07 PM
The plug can't get info from MM till you bake.

Or use PSK, it allows you to name the animations.

But really, it's the same thing, either you do it, or the programmer does it. What way is faster?

Adrian Lopez
05-08-2006, 01:28 PM
Why not? I've performed some experiments and it seems I should be able to list channel groups and envelopes using the channel info global, and obtain their animation curves using the animation envelopes global.

MotionMixer motions are stored under the MotionMixer channel group.

Lamont
05-08-2006, 01:45 PM
Why not? I've performed some experiments and it seems I should be able to list channel groups and envelopes using the channel info global, and obtain their animation curves using the animation envelopes global.

MotionMixer motions are stored under the MotionMixer channel group.It's how the exporter works. It's how a lot of animation exporters work. The motions aren't really on the bones/object at that time. They move, but they are driven by something that's not keyframes.

Adrian Lopez
05-08-2006, 02:07 PM
Are you thinking of a particular exporter? I am talking about creating a custom exporter, reading the animation curves that MotionMixer itself keeps for each actor. Here is what it looks like in Graph Editor:

Lamont
05-08-2006, 03:45 PM
Are we still talking about DX?

Adrian Lopez
05-08-2006, 03:52 PM
I thought we were talking about the Lightwave side of things. I'm saying that it is in fact possible to export animation curves from MotionMixer, so it's simply a matter of creating a plugin that does so.

Lorigosolo
05-08-2006, 08:37 PM
Lol!! Discussion Time!! ;)

Yes I know Lamont, it´s almost the same thing to have the Programmer or the Artist do that job, one way or another the time to achieve that will be spent by one of them!!

I just talked to the lead programmer and he will take a look at the LW SDK and see if it is worth it to make a plugin for our project or it´s best to do this by hand (Programmer).

But Adrian idea it´s good and seems posible, so first i will need to see if the programmer wants some "extra work"!! ;) If he could make a plugin that gets the information stored in the MotionMixer tracks and export each motion stored in MM to directx as an Animationset (each motion). It could be really cool!! :D

For now i´m using Lamont´s method, i export all the animations and GOD BLESS THE PROGRAMMER!! :p

Adrian Lopez
05-09-2006, 01:42 AM
Here is some quick and dirty code that demonstrates how one might go about extracting motions from MotionMixer. I don't feel like explaining the code, but the idea is that once you find an object within a particular actor you then call MotionMixerOpenActorObject() and it returns a list of motions and their animation envelopes.



#define MotionMixerFirstActor(cinfo) MotionMixerNextActor(cinfo, 0)
LWChanGroupID MotionMixerNextActor(LWChannelInfo *cinfo, LWChanGroupID actor)
{
LWChanGroupID channelgroup;

channelgroup = cinfo->nextGroup(0, 0);
while (channelgroup)
{
if (strcmp(cinfo->groupName(channelgroup), "MotionMixer") == 0)
return cinfo->nextGroup(channelgroup, actor);

channelgroup = cinfo->nextGroup(0, channelgroup);
}

return channelgroup;
}

#define MotionMixerFirstActorObject(cinfo, actor) MotionMixerNextActorObject(cinfo, actor, 0)
LWChanGroupID MotionMixerNextActorObject(LWChannelInfo *cinfo, LWChanGroupID actor, LWChanGroupID object)
{
return cinfo->nextGroup(actor, object);
}

struct MMObjectEntry
{
char *motionname;
char *parametername;
LWEnvelopeID envelope;
};

struct MMObjectState
{
int numentries;
struct MMObjectEntry *entries;
};

int CompareEntriesByMotionName(const void *v1, const void *v2)
{
const struct MMObjectEntry *e1 = v1;
const struct MMObjectEntry *e2 = v2;

return strcmp(e1->motionname, e2->motionname);
}

struct MMObjectState MotionMixerOpenActorObject(LWChannelInfo *cinfo, LWChanGroupID object)
{
LWChanGroupID changroup;
LWChannelID channel;
struct MMObjectState state;
int index;

state.entries = 0;
state.numentries = 0;

changroup = cinfo->nextGroup(object, 0);
while (changroup)
{
channel = cinfo->nextChannel(changroup, 0);
while (channel)
{
if (strcmp(cinfo->channelName(channel), "Default") != 0
&& strcmp(cinfo->channelName(channel), "Backup") != 0)
state.numentries++;

channel = cinfo->nextChannel(changroup, channel);
}

changroup = cinfo->nextGroup(object, changroup);
}

state.entries = malloc(sizeof(struct MMObjectEntry) * state.numentries);
if (state.entries == 0)
{
state.numentries = 0;
return state;
}

index = 0;
changroup = cinfo->nextGroup(object, 0);
while (changroup)
{
channel = cinfo->nextChannel(changroup, 0);
while (channel)
{
if (strcmp(cinfo->channelName(channel), "Default") != 0
&& strcmp(cinfo->channelName(channel), "Backup") != 0)
{
state.entries[index].parametername = (char*) cinfo->groupName(changroup);
state.entries[index].motionname = (char*) cinfo->channelName(channel);
state.entries[index].envelope = cinfo->channelEnvelope(channel);

index++;
}

channel = cinfo->nextChannel(changroup, channel);
}

changroup = cinfo->nextGroup(object, changroup);
}

qsort(state.entries, state.numentries, sizeof(struct MMObjectEntry), CompareEntriesByMotionName);

return state;
}

void MotionMixerCloseActorObject(struct MMObjectState *state)
{
if (state->entries != 0)
free(state->entries);

state->entries = 0;
state->numentries = 0;
}

Malasieno
05-09-2006, 12:00 PM
Well Loringosolo.. you could export from lightwave with DStorm plugin and import the .X obj animated in a program called FragMotion.

http://www.fragmosoft.com/

With fragMOTION you can easily split one single animation in multiple animation sets.

Lorigosolo
05-09-2006, 12:09 PM
Thanks Malansieno i will check that out but i will still try to make a plugin that export the MM chanel to DX format!! Well, at least try to see if it is posible!!

And thanks Adrian for the code, i will see if the programmer of our project can make a plugin and will keep you posted if he accepts!! ;)

Adrian Lopez
05-09-2006, 03:42 PM
After further experimentation with MotionMixer I have noticed there doesn't seem to be a way for the plugin to determine the length of each motion as it appears in MotionMixer. If you do decide to go with the custom plugin, you and your programmer will have to rely on the last keyframe of each motion's curves to determine the length of each motion. :(

I wish Newtek would write a global handler for MotionMixer.

Malasieno
05-10-2006, 04:52 PM
Loringosolo.. if you made this plugin it would be great to export MM animated mesh in .X format. Do you think to share it?

Lorigosolo
05-12-2006, 12:34 PM
Ooohhh that´s bad news!! :(

I will ask the programmer to check that out, unfortunally he has gone on a mini-vacations and will be back next week!! Lucky bastard!! ;)

Malesieno, IF the programmer accepts the challenge and IF it´s actually possible to do it (Adrian said that there is no way to know the end of each motion in MM), then we shall see!! I´m sure we will share it because the idea was not mine and it could be of great use for others Waver´s in the game area!!

BUT I REPEAT, DON´T PUT YOUR HOPES TOO HIGH, BECAUSE I DON´T KNOW IF THE PROGRAMMER WILL WANT TO DO IT OR IF IT CAN BE DONE!!

Cya guys!! Will wait until next week and will keep you updated!! ;)

Lorigosolo
05-24-2006, 12:04 PM
Well guys, my programmer told me he would take a look at the LW Sdk but didn´t said that he would actually do a plugin for that!! :( So for now we are using the MViewer to make the Animations sets!! Export each animation with Lightwave giving it a Generic Name and then we "merge" those animations with MViewer in one file!! It works pretty well with the D-Storm plugin!! Great Combo for those who are using the .X files!! ;)

Sorry guys for that, hope that in the future (LW9 or 9.5) we could use MM with DX!! :)

SonicPerfect
07-07-2008, 07:54 PM
Hi, Lorigosolo!! Do you have the link for MViewer !?
Please share with us!!

Lorigosolo
07-13-2008, 06:28 PM
English Version:.

Hi Elinewton, you can find the Mviewer within the DirectX Export plugin folder from DStorm, i think there is a folder named viewer that comes with that plugin and inside you will find an older version of Mviewer. (link: http://www.dstorm.co.jp/english/plugin/object.htm#DirectX2 )

The Mviewer comes with the SDK of the DirectX, so if you have installed the SDK DirectX version you should have an updated Mviewer within the DirectX folders. If not, I have a version of Mviewer that is newer than the one that comes with the Dstorm plugin, i will see if i can find it and post it here. :thumbsup:

By the way, congrats on Kerry!! Awesome work!! :thumbsup:

--------------------------------------------------------------------------
Portuguese Version:.

Oi Elinewton, tudo bom?? :)

Acredito que o Mauro já te comentou aonde encontrar o plugin pra exportar animações ao formato DirectX, com o plugin vc já tem um Mviewer que e meio arcaico mais serve pra ver se as animações foram exportadas bem o não.

O Mviewer e distribuído junto com o SDK do DirectX, eu tenho um Mviewer modificado por um amigo programador que funcionava melhor que esse que vem com o plugin da DStorm e tmb tinha algumas funções interessantes que o outro não tem. Assim que eu vou procurar esse MViewer e coloco aqui pra que vc e outros Wavers possam usarlo, si por algum motivo não me deixam por o file no foro, eu passo ele pro Mauro!! :thumbsup:

Manero o trabalho que vc ta fazendo com a Kerry!! Congrats!! :thumbsup:

(Desculpa pelo meu português meio obsoleto, faz muito tempo que não escrevo em português :oye: )