Author Topic: Convert joints to bones(done)  (Read 7461 times)

alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones, possible?
« Reply #15 on: July 22, 2016, 06:08:06 pm »
Actually, you could do an interesting dream or ghost sequence with the model all disarranged like that... :lol:

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #16 on: July 23, 2016, 02:55:08 am »
A possible solution:
1. Create the T-posed mesh using the old way.
2. Posed the bones, but do not link them to the mesh.
3. Created another set of bones using the positions of the posed ones.
4. Link the mesh to the 2nd set of bones and delete the old bones.
5. Find a way to animate the new skeleton.

Well this is what I have so far. At least the rotation part is correct(or at least is looks OK).


alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones, possible?
« Reply #17 on: July 23, 2016, 07:51:16 am »
Definitely an improvement over having his shoulders indented all the way to his hips.  :D

I guess that's the Swallow over there to the side--it looks really odd from that angle.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #18 on: July 23, 2016, 08:34:38 am »
I think the translation part is wrong. The shoulders look slightly dislocated because the joints also move a little other than just rotate. The weapon, however moves a long distance from between his feet to his hands, so it looks ridiculous. Same thing happens to Kid's skirt (I'm surprised it even uses multiple bones).

Well, actually I'm confused because it seems blender uses different coordination system for bones and other objects. When creating the T-posed skeleton, it doesn't matter because all bones are in the center of the global space. But to move them further, it has to be specific.



I also posted a question on stackoverflow.
https://stackoverflow.com/questions/38541723/apply-rotation-and-translation-to-bones



Since the maximum number of joints in a model is 32, some models lack a weapon bone.
Well it seems the wiki is wrong because battle models can certain have more than 32 joints...
For example, Kid has 39 joints include the weapon (blame the braid and the skirt).
« Last Edit: July 23, 2016, 09:52:15 am by utunnels »

alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones, possible?
« Reply #19 on: July 23, 2016, 01:28:16 pm »
It almost looks like the bone in Serge's left upper arm is curved there, although I suppose it could be just an artifact of the screenshot. I wonder--are the shoulders truly, conceptually translating, or did they just use that as a kind of shorthand for rotating the upper torso, shoulders included? I don't know how you re-rigged this, but if you followed the original pattern, the shoulders aren't connected to the spine at shoulder level, as would be expected based on the way a real human skeleton works... (I may be too hung up on how real human skeletons work. If so, I apologize.)

About the number of joints--I think that line refers only to the overworld models, but it's possible that the reason for some of them not having weapon joints may be due to something other than a joint number restriction (in fact, from the look of it, all of the overworld models should have a couple of unused joint slots, since the max listed is 30, for Leena and Riddel). Maybe those characters just never participate in a sequence where they pull their weapon before a combat has actually started?

TheMage

  • Artist of Termina
  • Time Traveler (+800)
  • *
  • Posts: 874
  • Dreaming through time.
    • View Profile
Re: Convert joints to bones, possible?
« Reply #20 on: July 23, 2016, 02:32:41 pm »




It almost looks like the bone in Serge's left upper arm is curved there, although I suppose it could be just an artifact of the screenshot. I wonder--are the shoulders truly, conceptually translating, or did they just use that as a kind of shorthand for rotating the upper torso, shoulders included? I don't know how you re-rigged this, but if you followed the original pattern, the shoulders aren't connected to the spine at shoulder level, as would be expected based on the way a real human skeleton works...


I wouldn't put it past the developers to take shortcuts around the human skeleton, especially in the 90's, graphics were changing so fast.

Hmm most of this stuff is over my head but out of curiosity how many polygons do the Cross models roughly have? If the conversion of joints to bones is possible would it also be possible to add polygons?


alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones, possible?
« Reply #21 on: July 23, 2016, 06:19:29 pm »
If the conversion of joints to bones is possible would it also be possible to add polygons?

Directly inside the existing game, you mean? In theory, but It's Complicated. You'd need to manipulate section 1 of the .mdl file, adding vertices to the vertex pool and corresponding UV map information (possibly adding constructs, too).

Outside the game? Presumably it would be no different from editing any other 3D model. I don't think we have the means to convert back to Cross's in-game format, though.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #22 on: July 23, 2016, 07:52:28 pm »
In theory, posing is easier than editing the mesh.
For the reason the way cc uses to handle vertices that are connected to 2 joints can not be reverted easily.

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #23 on: July 23, 2016, 08:25:45 pm »
I wonder--are the shoulders truly, conceptually translating, or did they just use that as a kind of shorthand for rotating the upper torso, shoulders included? I don't know how you re-rigged this, but if you followed the original pattern, the shoulders aren't connected to the spine at shoulder level, as would be expected based on the way a real human skeleton works... (I may be too hung up on how real human skeletons work. If so, I apologize.)
Some times it takes more than rotation of the upper body to shrug your shoulders, or you need to add extra joints between shoulder and neck, same cost but perhaps not as easy as moving the shoulders directly. And when swinging a weapon we need to adjust the positions of the shoulders otherwise it looks too stiff.

And yes, the shoulders are connected to joint 2 (the joint that controls the upper body). Because only the relative movements of the joints matter, no matter how far aways they are apart. Even though it looks like they connect with the waist, they don't move with the waist (the waist is controled by joint 1).

Quote
About the number of joints--I think that line refers only to the overworld models, but it's possible that the reason for some of them not having weapon joints may be due to something other than a joint number restriction (in fact, from the look of it, all of the overworld models should have a couple of unused joint slots, since the max listed is 30, for Leena and Riddel). Maybe those characters just never participate in a sequence where they pull their weapon before a combat has actually started?
The overworld models don't have weapon bones, or as far as i know. Maybe there is a script to bind weapons to a certain joint when needed. The overworld weapons are also complete models than just mesh. In the other word, weapons used in battle are parts of the character models.

Quote
It almost looks like the bone in Serge's left upper arm is curved there, although I suppose it could be just an artifact of the screenshot.
Yes it is bended for some reason. I compared it to a normal model exported before.
« Last Edit: July 23, 2016, 08:59:45 pm by utunnels »

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #24 on: July 25, 2016, 10:18:06 am »
OK I found the reason why the weapon and shoulders were in wrong positions.
(I really hate math, I spent the whole day trying to figure it out)

This time the position is correct, but the angle is a bit off. :evil:




Edit*


Oh, well, the reason the angles are wrong is because rotations are relative to the bone itself. So if a bone is created with rotation, the coordinates are also rotated.
How to convert the rotation in 3D to match the new coordinates is currently beyond my sleepy brain.
« Last Edit: July 25, 2016, 01:58:54 pm by utunnels »

alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones, possible?
« Reply #25 on: July 25, 2016, 10:07:13 pm »
The simplest thing to do is apply the bone's initial rotation in reverse, then apply the new rotation. I think. The answer's probably in this somewhere, but I don't have the time or energy to read it all right now, and I haven't done the kind of vector and matrix math involved in this stuff since university, ~20 years ago. (Typing that makes me feel old, sigh.)

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #26 on: July 25, 2016, 11:57:33 pm »
Thanks alfador. Well, to me it is 15 years ago. LOL

utunnels

  • Guru of Reason Emeritus
  • Zurvan Surfer (+2500)
  • *
  • Posts: 2797
    • View Profile
Re: Convert joints to bones, possible?
« Reply #27 on: July 26, 2016, 11:01:40 pm »
OK, this time it works.




I was confused by euler angles and rotation matrix conversion. Now I know how the code works...
« Last Edit: July 26, 2016, 11:42:44 pm by utunnels »

alfadorredux

  • Entity
  • Mystical Knight (+700)
  • *
  • Posts: 746
  • Just a purple cat
    • View Profile
Re: Convert joints to bones(done)
« Reply #28 on: July 27, 2016, 07:44:19 am »
Looking good!  :D

prizvel

  • Guru of Time Emeritus
  • Guardian (+100)
  • *
  • Posts: 118
  • Our planet's dream is not over yet
    • View Profile
Re: Convert joints to bones(done)
« Reply #29 on: July 27, 2016, 03:25:07 pm »
Nice work!