Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server
You last visited: Today at 19:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Trying to read Bone info in 3DC files

Discussion on Trying to read Bone info in 3DC files within the Shaiya Private Server forum part of the Shaiya category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2010
Posts: 523
Received Thanks: 523
Trying to read Bone info in 3DC files

I didn't put this in the "SMOD" thread so we don't mix things.

I'm trying to load 3DC models (Mobs actually) into 3dStudio. So far I can read the 3D info (vertices, faces, etc) to form the model:


But for this to be useful, we also need the bones info. (So we later can save that back to a 3DC file).
And I fail to read that, this is what I get (all messed up bones):


In 3dstudio, to create a bone, we do
BoneSys.createBone <point3>startPos <point3>endPos <point3>zAxis

Using the info from castor4878 in this post I can read the bone data, into a transform matrix:

tfm = matrix3 [m11,m12,m13] [m21,m22,m23] [m31,m32,m33] [m41,m42,m43]

But this is a 4x3 matrix, while 3DC says 'a 4x4 matrix' (I think so )
Also to build a bone hierarchy we would need each bone ParentID, so all bones form a 'chain'.

So, anyone knows what info is stored in that '4 x 4' matrix or has a dump of the data? Or any more info about the BoneMatrix in 3DC files?

PS: This is the code used to import a 3DC from Data\Monster\3DC (use it on a small mob that has only 1 MODEL!)

You just run it and the mob will be created in 3dstudio.

Edit:
I've searched everywere and looks like none faund a way to extract bone info into a 'useable' skeleton. So, no way to make new mobs with new animations.

Now, with the code I posted above, you can also import armors into 3dstudio (withoout bones). Just import them piece by piece, they will take the correct position.
Same with complex mobs or bosses with multiple pieces, import them piece by piece, then group them in 3dstudio. You can apply the game textures to the models, and they will match.
At least is useful if you want to render them and make original pictures, to use in the Loading... screens.

Here's a test:

If you have any doubt, maxscript its a huge language, and has a online manual with all the commands.
sominus is offline  
Thanks
6 Users
Old 09/24/2019, 11:41   #2
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,366
Quote:
Originally Posted by sominus View Post

In 3dstudio, to create a bone, we do
BoneSys.createBone <point3>startPos <point3>endPos <point3>zAxis

Using the info from castor4878 in this post I can read the bone data, into a transform matrix:

tfm = matrix3 [m11,m12,m13] [m21,m22,m23] [m31,m32,m33] [m41,m42,m43]

But this is a 4x3 matrix, while 3DC says 'a 4x4 matrix' (I think so )
Also to build a bone hierarchy we would need each bone ParentID, so all bones form a 'chain'.
Since years I've made only few (actually not significant) progress on these matrixes.
At least, since the last column is always a vector (0,0,0,1), I feel that they are quaternions expanded to matrix4x4 (possibly a kind of orientation at rest).
In the referenced post, I used the names "BoneMatrix" and "bone1", "bone2" as indexes in that array, but all these nouns were borrowed from structures that looked like them.

I'm not sure whether you're looking for points that contact each others to define a skeleton but names "startPos, endPos and zAxis" may let think so.

Each vertex does contain a position ("at rest") and at least 2 (perheaps 4) indexes of matrix; what would mean a "starting or ending position" for each vertex ?

At least, when one checks the matrixes of a top, bottom, hand & boots .3DC for a given class/sex; they appear to be all identical(1), and so would define all articulation points of a body (player toon, NPC, mob, ...) and not the "bones" (lines that draw the skeleton) of that part of the body; but there I'm sure I'm not reading "bone" with the right (your) meaning.
(1) usually identical but some can contain additional quaternions at end of the list.

My understanding so far is that each vertex is "attached" to matrix(es) (or quaternions) and when a move occurs (as per .ani settings - still not fully understood) each vertex is moved by "some operations" performed between the matrix(es) listed by the vertex and modifiers (translations, rotations) of the .ani. With that hypothesis, the concept of a chain of nodes (point3D or bones or anything) is not required; there is only facets, defined by vertices, and each move is just a move of each facet - and possibly I'm an idiot to not being able to code the few required matrix operations.


Quote:
Originally Posted by sominus View Post
So, anyone knows what info is stored in that '4 x 4' matrix or has a dump of the data? Or any more info about the BoneMatrix in 3DC files?
Possibly, Zoltán Kárpáti, the author of .
(I exchanged with him in April 2011 to debug some issues of my first 3D viewer.

Here is how he success to draw the Character/human/3DC/co_humf_upper003.3DC file:

Regarding "dump of the data", a copy from the .3DC viewer of shStudio copies a bitmap and a text definition, pasting in a text-consumer appl will give some dump (usable as samples).

Edit:
By April 26th 2013, I had an exchange with Zoltán on these quaternions (or bones...)
In spoiler below, my questions are in dark-red, his answers in green (some red & blue from his response)


Possibly part of this information will help you to validate your Shayia to 3DStudio conversion.
/Edit

Quote:
Originally Posted by sominus View Post
I've searched everywere and looks like none faund a way to extract bone info into a 'useable' skeleton. So, no way to make new mobs with new animations.
The .ani file, as far as I understand them, consists in a set of sequences (steps of the animation), each step contains:
- a matrix4x4 (where the last column is also (0, 0, 0, 1))
- a list of Index (possibly index of a quaternion of the item to animate) + Vector4 (vector of 4 floats)
- a list of Index (possibly index of a quaternion of the item to animate) + Vector3 (vector of 3 floats)

Possibly, the Vector4 could define a rotation, the Vector3 could define a translation.

Being able to animate some points using the right math may give the keys to understand the shaiya logic; unfortunately I leak some knowledges to do that and so far I haven't find the time to improve them - all 3D modeling appls draw some so nice rotation nodes and let you select and activate the 3 pretty small arcs of rotation (axis of rotation) of these nodes but of course none gives (to idiots) the algebra logic (a long step-in analysis in an open source project may help).

Quote:
Originally Posted by sominus View Post
Now, with the code I posted above, you can also import armors into 3dstudio (withoout bones). Just import them piece by piece, they will take the correct position.
That's the easy point indeed.
All shapes that consist in several smaller (sub) shapes always share the same coordinates scale and origin.
(the viewer of .3dx (that draws the top, bottom, hands & boots of a toon) simply draws all pieces w/o caring about coords)
castor4878 is offline  
Thanks
3 Users
Old 09/25/2019, 02:44   #3
 
elite*gold: 0
Join Date: Jul 2010
Posts: 523
Received Thanks: 523
I know the way Zoltán told us to load and save bone info, he posted that time ago. But that involves just editing the current shape of an armor (we can't remove or add vertices so we cant actually create a brand new original armor).

Quote:
Each vertex does contain a position ("at rest") and at least 2 (perheaps 4) indexes of matrix; what would mean a "starting or ending position" for each vertex ?
Start pos is where a bone start, end pos is where it ends so it define its lenght. So, start pos of bone02 would be = end pos of bone01.
Normally, bones are connected (linked), so when you rotate a shoulder, all next bones (arm, elbow, hand) will follow that rotation correctly.
I asume the so called matrix4 is what actually allows (by doing maths in the code) to achieve that.
Now, may be (in the game) the bone lenght and parenting to each other is not needed, so we only draw the bone dots (like vertices), and not the lenght.


These are bones draw by hand to (barelly) represent a human skeleton.
The parts in red circle are 'joints' and the part in blue circle are the bones.

Normally (but may be not generally), the part in blue circles is what 'attracts'
vertices from the 3d mesh to move them (or deform them), due to the weight info.


And this is what I get importing Mob_FOx_01.3DC

As you can see the bone skeleton looks like just a random sequence of bones, no noticeable 'shape' at all.

In other games, the mesh file also contains the bones Indexes, that way you know how bones are 'linked' to each other and how the skeleton is built. But 3DC files doesn't have that info (AFAIK), so here Im reading bones just in the sequence they are written in the 3dc file. (But even so... the should make a correct shape).

AND... of course I might be reading them the wrong way, that's why they don't conform a correct skeleton shape.

In my case Im using the info this way (to make a single bone):

BoneSys.createBone
<p3>startPos
<p3>endPos
<p3>zAxis


column4
column4 * (column1)
column3


I took that from a forum

But then again, it might not be the right way to read shaiya bone info.

PS: You say column4 is a vector, [0,0,0,1], but Im not geting that info. This is a line from my bone reading:
Quote:
"Row1: [1.37091e-006,0,1] Row2: [0,1,0] Row3: [-1,0,1.37091e-006] Row4: [0.356065,-0.538229,-4.88133e-007]"
All the remaining lines looks like that one.

If you want a open source project, BLender is open source and it supports python (to make scripts). I just don't use it because its learning curve is harder for me and I already know the basis for 3dstudio.

But... for anyone here starting from scratch into this, Blender is a very small free download, and it needs many less resources than 3dstudio.

I found this paper about matrix, but it's a very loooong read:
sominus is offline  
Old 11/01/2020, 22:47   #4
 
elite*gold: 50
Join Date: Sep 2011
Posts: 408
Received Thanks: 1,262
Quote:
Originally Posted by sominus View Post
In my case Im using the info this way (to make a single bone):

BoneSys.createBone
<p3>startPos
<p3>endPos
<p3>zAxis


column4
column4 * (column1)
column3

Not sure if you're still interested but you should follow the steps below.

1. Ignore column 4
2. Create an inverse matrix of 4x3 matrix that you see when you ignore the 4th column
3. Use 4th row as startpos
4. Use startpos+(length*DirectionX) as EndPos (where DirectionX is Row1)
5. Use DirectionZ as "zAxis" (where DirectionZ is Row3)

P.S. length = sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) works good enough to find out which bones are connected together but if you just want to see the bone points you can use 0.1 or something.

JuuF is offline  
Thanks
1 User
Old 11/02/2020, 04:46   #5
 
regvn's Avatar
 
elite*gold: 0
Join Date: Jul 2013
Posts: 17
Received Thanks: 39
If you want to import bones and animation, the best way I do research is to use Fatimport, a software written by a Chinese friend a long time ago. Unfortunately Shaiya is not included, but he said Shaiya has a structure that is easy to handle and he came up with a script like this that I don't know about the script.

Fatimport can be downloaded here
regvn is offline  
Old 11/22/2021, 02:04   #6
 
elite*gold: 0
Join Date: Mar 2017
Posts: 2
Received Thanks: 0
Exclamation

Quote:
Originally Posted by sominus View Post
In my case Im using the info this way (to make a single bone):

BoneSys.createBone
<p3>startPos
<p3>endPos
<p3>zAxis


column4
column4 * (column1)
column3


I took that from a forum
Hello sominus! you were able to load the armature of the .3dc files? I saw that 3d object converter supports it but sadly you need to pay to be able to export the model.
ZEHLENDORF is offline  
Reply


Similar Threads Similar Threads
[Looking For]Monster Files Ep.6 DDS & 3DC & ANI Files.
08/20/2014 - Shaiya Private Server - 4 Replies
I am looking for someone that might have KR Shaiya's latest working monster models, due to be missing some in the data in the mon file it seems i am missing about 20-30 models only, i am asking if anyone has the KR Shaiya 3dc, dds, ani files recent from Shaiya KR that are fixed in anyway so i might be able to fix my monster models, or simply sending me the patch links, i will grab it myself and if the 3dc files need to be fixed i will fix them no more than that is what i need. Thanks in...



All times are GMT +1. The time now is 19:24.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.