Questions on bone animation

Posted By: lemming

Questions on bone animation - 09/12/12 12:56

Hey everyone!

I'm working on an animation script for a customizable character but I think my approach is not so great. I hope you can give me some advice.

I have a basic model (a "naked" character) and up to about 7 armor pieces (feet, torso and so on). The armor is placed at the character position and by ent_animatefrom animated the same way as the character (character and armor have the same bones).
This is ok at 16 characters, but with more it starts to consume too much fps.

Is there a way to do it better without shaders (I have the Extra Edition)?

I tried copying the bone angles directly without "animating" the armor, but the speedup was practically nothing.


Another question I have in mind: I've seen basically two different types of bone animations. One with a "connected" skelleton (one bone starts where another ends) and one with a "disconnected" skelleton (bones are distributed over the model and not directly connected). Which one is in which case to prefer? Does this also affect the framerate?

Thank you for your answers!
Posted By: Doc_Savage

Re: Questions on bone animation - 09/12/12 14:08

hey there, im not the best at gamestudio, but im certanly not the worst.
did you try checking your game code to see how many functions are runing at the same time? too many running at the same time can cause hanging, hit f11 in game to see a list of everything, "fnc" should be the number of functions.

also ive heard a good way to animate weapons/armor, etc with models is to animate it WITH the model, as in put your armor on your guy, animate him, then sae your armor as a separate model. im a bit unsure as to the details of this strategy, but perhaps someone else could put a word in?

i hope i was able to help laugh
Posted By: sivan

Re: Questions on bone animation - 09/12/12 14:22

and if you convert bone animations to vertex animation, it will consume more memory but will be really faster. more ugly way, but works.
Posted By: lemming

Re: Questions on bone animation - 09/12/12 21:39

@Doc: Thanks, but it's not the functions. I made a testscript especially for the animations that runs nothing else.

@Sivan: I guess I can't get around bones, as vertex animations can't be blended or mixed. =/ But I need these features.


I read in several other threads about combining meshes. Is this possible in this case, too?
Posted By: sivan

Re: Questions on bone animation - 09/13/12 07:23

yes if you need nice blended animations you cannot use vertex animation, it is only for simple things, like in a RTS with a relatively far camera view
Posted By: tunisod

Re: Questions on bone animation - 11/26/12 05:06

Hey Lemming, can you give me a quick example on how you used ent_animatefrom?
I'm trying to use it but i cant get the armor animation to sync with the model.
I'm using the same skeleton and animations for both the model and the armor.
The manual dosent really provide an example for ent_animatefrom and I've
checked out the bone example in the tutorial and
it's great if I want a bone to act independantly.

Thanks for any help anyone can give me.
Posted By: rayp

Re: Questions on bone animation - 11/26/12 07:40

Quote:
can you give me a quick example on how you used ent_animatefrom?


Code:
ENTITY* anmsource;
action AnmSource_Model() //apply to model with animations
{
 anmsource = me;
}
action Model_NoAnims()
{
 while(!anmsource) wait(1);
 while(1)
 {
  my.skill1 += time_step;
  ent_animatefrom(me, anmsource, "idle", my.skill1, ANM_CYCLE)
  wait(1);
 }
}



Quote:
Like ent_animate, but loads the bones animation from a separate entity. This way entities can share bones animation scenes.


Edit:
@lemming
Did u set the passable flag of the attached "bodyparts" ? Might save some frames...
greets
Posted By: tunisod

Re: Questions on bone animation - 11/26/12 20:10

Awesome, thanks for the quick responce RayP.

That example really needs to go into the manual.
Posted By: lemming

Re: Questions on bone animation - 11/26/12 22:22

rayp was faster, but if you're still interested in my code:

Code:
void pl_Animate(ENTITY* chara, STRING* scene, var percent, var mode)
{
	ENTITY* piece;

	if (chara != NULL)
	{
		ent_animate(chara, scene, percent, mode);
		
		if (chara.phair != NULL)
		{
			piece = (ENTITY*)chara.phair;
			ent_animatefrom(piece, chara, scene, percent, mode);
			vec_set(piece.x, chara.x);
			vec_set(piece.pan, chara.pan);
		}
		if (chara.pchest != NULL)
		{
			piece = (ENTITY*)chara.pchest;
			ent_animatefrom(piece, chara, scene, percent, mode);
			vec_set(piece.x, chara.x);
			vec_set(piece.pan, chara.pan);
		}
		// and so on
	}
}



phair and pchest are skills I use to store pointers. The codeblocks repeat for all armor/clothing/whatever pieces.
Posted By: tunisod

Re: Questions on bone animation - 11/27/12 00:08

No, that's great. The more info the better since I
really didnt have much to go on before you and RayP.

I did have a quick question. do you still use proc_mode = PROC_LATE; or is that only used for vertex?
Posted By: lemming

Re: Questions on bone animation - 11/27/12 01:31

Originally Posted By: tunisod
No, that's great. The more info the better since I
really didnt have much to go on before you and RayP.

I did have a quick question. do you still use proc_mode = PROC_LATE; or is that only used for vertex?


Not sure what you mean, but I don't use it.
Posted By: rayp

Re: Questions on bone animation - 11/27/12 06:41

@Lemming
Again, did u set the passable flag of the attached entitys ?

Iam interested in this thread, cause i never managed to use more "combined" models than 15 (as u said) with a good framerate. Another way could be to use one (complete) model and vmask.
Posted By: zeeshan

Re: Questions on bone animation - 12/20/12 09:51

thanks everyone.
© 2024 lite-C Forums