Jump to content

ambient sequence


Recommended Posts

Yes, tsStatics and PhysicsShapes at least can play their ambient sequences by default, which can be really handy for background animation on stuff in the level, without having to go to the trouble of running it all manually.


Not sure what you mean @Duion about "when you animate a model", because this is only for the ambient sequence itself, you should give other sequences their own names.

Link to post
Share on other sites

What do you mean "there are no other sequences"?


Ambient is one sequence, with its only special behavior AFAIK being the fact that it's the sequence that gets played automatically in many cases. However each TSShape can have a large array of other named sequences, each with its own set of keyframes stored in the nodeRotations/nodeTranslations vectors.


Obviously you've done a lot of character animating, so you know about multiple sequences on a model... so I must be misunderstanding what you're saying?

Link to post
Share on other sites

Interesting. Sorry, I'm coming at it from the code side and am apparently not familiar with the way a lot of people work. What I'm accustomed to is having a lot of individual sequence files, and then packing them on the character in the shape constructor, ie

 

function SoldierDAE::onLoad(%this)
{
  %this.addSequence("./Anims/PlayerAnim_Lurker_Back.dae Back", "Back", "0", "-1", "1", "0");
  %this.addSequence("./Anims/PlayerAnim_Lurker_Celebrate_01.dae Celebrate_01", "Celebrate_01", "0", "-1", "1", "0");
  %this.addSequence("./Anims/PlayerAnim_Lurker_Crouch_Backward.dae Crouch_Backward", "Crouch_Backward", "0", "-1", "1", "0");
  %this.addSequence("./Anims/PlayerAnim_Lurker_Crouch_Forward.dae Crouch_Forward", "Crouch_Forward", "0", "-1", "1", "0");
  ...
}

 

And then just playing them by name after that.

Link to post
Share on other sites

Usually ambient is a long string of all animations together. You can then drag a sequence out from that ambient sequence animation by writing:

%this.addSequence("ambient", "insert_the_name_of_your_choice", "beginning number like 0", "end number like 120");

 

Their is more to it.... get Torsion and it will teach you all the stuff with nice pop up windows as you use the addSequence function :D


Some models come with the animations in one single thread called Ambient and other models are made with all the animations as split up independent files. It depends on your 3d model artist's way of working.


That is really all their is to it.

Link to post
Share on other sites
So I'm right and you cannot have multiple sequences in one model file.

 

I have been working with collada models who had one long thread with all the animations in the model file. I had to use the onload and addSequence to work with it. Other times I get dts models which have split up all the animations in many dsq files. Again it all depends on how the artist works. Who is right and wrong is not important. What is important is to know how to deal with such situations when working with the models in your project. :mrgreen:


As I wrote then Torsion has some good pop up windows that teach one the stuff fairly quickly.

Edited by Dwarf King
Link to post
Share on other sites

I think there is some slight confusion over a single word here.


A single model can contain single or multi track animations. As far as i am aware, the first track in a model is called ambient by torque, simply because as was state earlier 'ambient' can be switched on and played automatically by a tsstatic object.


All other models have more complex animation needs, speed of animation, multiple animations, all of which can be accessed in many ways.


Single track named segments, where you name parts of the track as explained by dwarfking.

Multi track, where each animation is named and separate inside the model.


Also if you are clever regarding your skeleton and animation designs you can turn each animation into a .DSQ file in a similar way to how Chris calef describes, the advantage here is that you can use all premade animations on all new character models if the root pose and rigging are the same.


So all in all there are several ways of working

Link to post
Share on other sites

What BloodKnight said.


I have no particular attachment to being right here, but I would not want newcomers to leave confused, and from my understanding of what's been said here and of what goes on in the engine, you're precisely not right, @Duion. I guess it depends on what you consider a "sequence", but from the engine side, each TSShape has an array of sequences, each with its own name. There doesn't even need to be an "ambient" sequence at all, if you don't name any of them "ambient".


It is true that each shape keeps one big list of all the transforms (really two lists, nodeRotations and nodeTranslations), and each sequence stores a starting point in these lists, and a number of frames. So if you want to call those lists "a sequence", then yes, all sequences are part of that, but that is the only way I see in which you could be considered "right". It seems more helpful to me, however, to treat individual sequences, having separate names and being stored in separate dsq files, as distinct and not as one big sequence, since the only real connection is that internally they are all kept in a big list.

Edited by chriscalef
Link to post
Share on other sites

Okay, I'm very sorry to keep beating this horse, but it is absolutely not dead yet, and it keeps kicking me. :-) After all the years I've been with Torque, I get very disturbed when I learn new "rules" that I've never heard of before, and I intend to lay this one to rest here and now.


The issue we are discussing with the ambient sequence has to be an exporter issue, not an engine issue. I have admittedly almost no knowledge of any of the Torque exporters, because I am not an artist and don't work with exporters, so someone will have to fill me in on which one(s) do this thing of forcing all sequences into one named "ambient".


But in the engine itself, there is *nothing* magical about the ambient sequence except for the fact that it often gets played by default. TSShape has a function called write(), with which you can save the model to a dts file, and when you do this on a shape that has sequences loaded, all of the sequences get saved out, with their names, and there is no stuffing them into or introduction of a special sequence called ambient. Here is a model with four named sequences, none of them ambient, created with a cs file and independent dsq files.


http://opensimearth.com/images/screenshots/m4_with_seqs.jpg


Here is the cs file with which I constructed this model, and to the left you'll see the new model I saved with the write() function, called M4_seqs.


http://opensimearth.com/images/screenshots/m4_cs.jpg


You will also note that there is no M4_seqs.cs file, meaning when I next load this model into the engine via creating a new TSStatic, it will have no shape constructor to load sequences. Here is my new model, with four working sequences, none of them named ambient.


http://opensimearth.com/images/screenshots/m4_export.jpg


And just to make sure the horse is good and dead, here's a screenshot from hexedit, examining the M4_seqs.dts file itself to make sure the sequence names are all there, and ambient is not. (Look toward the middle of the column on the right, you'll see TPose, root, idle etc.)


http://opensimearth.com/images/screenshots/m4_hexedit.jpg


So, while I do not doubt that one or more of the exporters force you to do this thing, I trust I have made it clear enough that the engine does nothing of the sort. Ambient is entirely optional, and it is very much possible to store multiple named sequences in a dts file without any of them being called ambient.


PS: if anyone wants to know how to use TSShape::write, it's very easy. Here's a sample method I put into PhysicsShape, but you could do a similar thing from TSStatic or ShapeBase or many other places.

 


DefineEngineMethod( PhysicsShape, write, void,  (const char *filename),,
  "@brief \n\n")
{
FileStream *outstream;
TSShape *kShape = object->mShapeInst->getShape();
if ((outstream = FileStream::createAndOpen(filename, Torque::FS::File::Write))==NULL) {
	Con::printf("whoops, name no good!"); 
} else {
	kShape->write(outstream);
	outstream->close();
}	
}

Link to post
Share on other sites

@chriscalef

The question remains how the sequences got there, are they just renamed sequences that has been split up from the ambient sequence like frame 1-19, frame 20-30 etc or a list of animations exported to a single file and then combined again into one file.

Link to post
Share on other sites

The answer is number two. TSShape::write saves a dts model that has sequences loaded onto it from individual dsqs, assembled with a shapeConstructor. When this model is written out, it exports as a list of separate sequences, with no necessity for even one of them to be named ambient. When you reload this file, it loads all its sequences in a list, there is no combining them into one ambient sequence and then breaking them up again.


Again, I am only speaking of what the engine does, however, with TSShape::write. What you are experiencing, I'm guessing, is a convention used by your particular exporter. As stated, I spend most of my time in Visual Studio and don't know much about the exporters, and I also don't own any of the art tools beyond Blender, so I'll have to leave it to others to figure out which of the exporter(s) do this thing.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...