B3d format and animation

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

well, i tried to debug it but i didn't find anything wrong..
i don't know what's going on. if i draw the parts, but don't make it to child, then it's working...

I put up the source the exe and the other files, so if you have some time, please take a look at it please.. ><;

http://dotdotdot.extra.hu/FTP/model_viewer.rar
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

maybe this is crazy but it works for now! :D
if i can't use childs then i thought that i'll make a code for animating it...
well, just with rotation, it's working, i dunno what will be with the animations (i'll test out later)

Code: Select all

void UpdateJoints()
{
	rhand->setPosition(jrHand->getAbsolutePosition());
	lhand->setPosition(jlHand->getAbsolutePosition());
	rarm->setPosition(jrArm->getAbsolutePosition());
	larm->setPosition(jlArm->getAbsolutePosition());
	head->setPosition(jHead->getAbsolutePosition());
	torso->setPosition(jTorso->getAbsolutePosition());

	vector3df vrot = jTorso->getRotation();
	CMatrix4<f32> m = jTorso->getAbsoluteTransformation();
	m.transformVect(vrot);
	torso->setRotation(m.getRotationDegrees());

	vrot = jHead->getRotation();
	m = jHead->getAbsoluteTransformation();
	m.transformVect(vrot);
	head->setRotation(m.getRotationDegrees());

	vrot = jrArm->getRotation();
	m = jrArm->getAbsoluteTransformation();
	m.transformVect(vrot);
	rarm->setRotation(m.getRotationDegrees());

	vrot = jlArm->getRotation();
	m = jlArm->getAbsoluteTransformation();
	m.transformVect(vrot);
	larm->setRotation(m.getRotationDegrees());

	vrot = jlHand->getRotation();
	m = jlHand->getAbsoluteTransformation();
	m.transformVect(vrot);
	lhand->setRotation(m.getRotationDegrees());

	vrot = jrHand->getRotation();
	m = jrHand->getAbsoluteTransformation();
	m.transformVect(vrot);
	rhand->setRotation(m.getRotationDegrees());
}
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

doesn't working with newton ><; it's too slow...

i downloaded irrlich 1.4 again, maybe there is something...
if i use the dll, which is on it (didn't compile) then it goes with 450 FPS! not 100!
and if i compile it, then it goes to 100 FPS..
and i have a problem too:

Code: Select all

bool CB3DMeshFileLoader::readChunkKEYS(CSkinnedMesh::SJoint *InJoint)
{
	s32 flags;
	file->read(&flags, sizeof(flags));
	#ifdef __BIG_ENDIAN__
		flags = os::Byteswap::byteswap(flags);
	#endif

	while(B3dStack.getLast().startposition + B3dStack.getLast().length>file->getPos()) //this chunk repeats
	{
		s32 frame;

		f32 positionData[3];
		f32 scaleData[3];
		f32 rotationData[4];

		file->read(&frame, sizeof(frame));

		if (flags&1)
			readFloats(positionData, 3);

		if (flags&2)
			readFloats(scaleData, 3);

		if (flags&4)
			readFloats(rotationData, 4);

		#ifdef __BIG_ENDIAN__
		frame = os::Byteswap::byteswap(frame);
		#endif

		core::vector3df position = core::vector3df(positionData[0], positionData[1], positionData[2]);
		core::vector3df scale = core::vector3df(scaleData[0], scaleData[1], scaleData[2]);
		core::quaternion rotation = core::quaternion(rotationData[1], rotationData[2], rotationData[3], rotationData[0]); // meant to be in this order
it says scaleData is used without being initialised..
maybe this is the problem? i'm did that:

Code: Select all

		f32 positionData[3]={0};
		f32 scaleData[3]={0};
		f32 rotationData[4]={0};
but the filesize is different too.
if i compile, it's 3,48 MB. if i use the old, it's 2,02...
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

no idea?
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I looked at the svn it seems changed, might want to try that.
panau
Posts: 3
Joined: Sun Mar 30, 2008 3:08 pm

Post by panau »

hi i have a problem when trying to set rotation of bone because when i use

node->setJointMode(EJUOR_CONTROL);

and i start animating character then part of my mesh starts "flashing", like if it was changing visibility of part of my mesh every frame, but not whole mesh
the rotation of bone is set correctly so there is no problem, also if i use node->setJointMode(EJUOR_READ); everything acts correctly
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

i had the same thing, but my problem was that, in my original model (so, not the animation) had bone rotation.
so, for example, a rotation for the head.
but when i reset the joints (in milkshape: tools -> zero joints) it became good.

should try it too.
baiqian
Posts: 43
Joined: Sun Apr 06, 2008 2:29 pm

Post by baiqian »

I'll do the same thing with B@Z did. I'll make a character customzation, so my character have to seperate in several pieces. I would like to know if B@Z's low FPS issue has been solved or not
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

aha

Post by netpipe »

can someone post the source again please.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

hey
its solved, and integrated in new irrlicht ( the problem was that it rendered the childs double times.. so

Code: Select all

                 1
                 /\
                2 2
                /\/\
              2 22 2
and so on, so with many childs, it makes veery slow :D
but its ok now)

by the way what you wanna do like i did?

tecan: what source?
Image
Image
baiqian
Posts: 43
Joined: Sun Apr 06, 2008 2:29 pm

Post by baiqian »

I've read your post b4, the code here

Code: Select all

jTorso = model->node->getJointNode("torso"); 
   jHead = torso->getJointNode("head"); 
   jrArm = torso->getJointNode("rarm"); 
   jlArm = torso->getJointNode("larm"); 
   jlHand = larm->getJointNode("lhand"); 
   jrHand = rarm->getJointNode("rhand"); 
    
   jTorso->addChild(torso); 
   jHead->addChild(head); 
   jlArm->addChild(larm); 
   jrArm->addChild(rarm); 
   jlHand->addChild(lhand); 
   jrHand->addChild(rhand);
And you said you want connect joint to joint instead of connect model to joint, how about like this

Code: Select all

jTorsoOfParent = model->node->getJointNode("torso"); 
   jHeadOfParent = torso->getJointNode("head"); 
   jlArmOfParent = torso->getJointNode("rarm"); 
   jrArmOfParent = torso->getJointNode("larm"); 
   jlHandOfParent = larm->getJointNode("lhand"); 
   jrHandOfParent = rarm->getJointNode("rhand"); 
// child joint
jTorsoOfChild = torso->getJointNode("torso");
jHeadOfChild  = head->getJointNode("head");
jrArmOfChild  = rarm->getJointNode("rarm"); 
jlArmOfChild = larm->getJointNode("larm"); 
jrHandOfChild = rhand->getJointNode("rhand");
jlHandOfChild = lhand->getJointNode("lhand");
// add child
 jTorsoOfParent->addChild(jTorsoOfChild); 
   jHeadOfParent->addChild(jHeadOfChild); 
   jlArmOfParent->addChild(jlArmOfChild); 
   jrArmOfParent->addChild(jrArmOfChild); 
   jlHandOfParent->addChild(jlHandOfChild); 
   jrHandOfParent->addChild(jrHandOfChild);
I didn't test the code since I don't have this kind of seperated models. I don't know whether it is possible to connect joint to joint.And you said in last post, the child was calculate twice, but i don't understand which function make it double calculate.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

the double calculate was irrlicht bug, dont mind it xD

making a joint child the other joint... i dont know it that will work..
maybe. have to try out :D
Image
Image
baiqian
Posts: 43
Joined: Sun Apr 06, 2008 2:29 pm

Post by baiqian »

Yesterday, i test a character with a sword attached on hand. i use mode-joint, and the sword attached correctly, I analysis the sword mesh in a model viewer, i found the sword has a joint at the handle of the sword. So it seems, when add child ,it will attach to the joint automatically? but if we attach a model with more joints, i don't know what will happen.
One more question, since your character seperate in several parts, how can you animated it. I mean, some animation related to all parts of the body, how you store your animation into the several parts, since irrlicht doesn't support skeleton store in a seperate file.
baiqian
Posts: 43
Joined: Sun Apr 06, 2008 2:29 pm

Post by baiqian »

Yesterday, i test a character with a sword attached on hand. i use mode-joint, and the sword attached correctly, I analysis the sword mesh in a model viewer, i found the sword has a joint at the handle of the sword. So it seems, when add child ,it will attach to the joint automatically? but if we attach a model with more joints, i don't know what will happen.
One more question, since your character seperate in several parts, how can you animated it. I mean, some animation related to all parts of the body, how you store your animation into the several parts, since irrlicht doesn't support skeleton store in a seperate file.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

well thats why you have to seperate model logically
so, seperate parts what has nothing to do with each other
eg: head, upper, lower, hands, legs
when running, head should do nothing (or move just a bit left right), upper: the hands moving, lower: moving legs, going body up down, legs: a bit movement, but doing nothing, hands: closing hands.
so, you dont have to see what the other parts doing.

for storing, you can store the animation for every model, or use useAnimationFrom.
Image
Image
Post Reply