View Single Post
Old 2018-11-22, 00:59
solarix's Avatar
solarix solarix is offline
Magic Level: Yellow Ball
Join Date: Sep 2018
Location: Switzerland
Posts: 21
Hi MrQuetch,
thanks for your anwser!

Originally Posted by MrQuetch View Post
You are doing great things with your knowledge. You look like you're getting very close to fully implementing the models.
Let's see what I can do . But having an engine supporting LBA1/LBA2 and custom models (3DS, Blender..) would be fun .
The geometry of the LBA2-models looks complete to me... Just the colors/texturing still don't work. Grrr...

Originally Posted by MrQuetch View Post
I still have yet to load in existing LBA 2 models myself. I've actually been working on a Maxscript to port fully custom models from Autodesk 3DS Max directly into the LBA2 model format. My next step is to create animated models within Unity.
That's great! Looks like we're working both on the same challenge.. Are you going to load original LBA2-Models (direct from body.hqr/ress.hqr) into unity?

Originally Posted by MrQuetch View Post
Remember that you need to allow the right amount of space - depending on if you want to draw a triangle or a quadrilateral. Also, the colors and material both use their own bytes.
My problem is simple: I don't understand the output of my own "loadPolygon" method (similar to "loadPolygon()" of lba2remake). I mostly get "hasTex == false" and color-indexes for black and violett. Maybe there's a bug in my parser or maybe I don't understand what I get. That's why I'm looking for a debuggable lba2-model loader.

Originally Posted by MrQuetch View Post
If I may ask a question, how did you get the bones working? I cannot get the vertices' offsets properly. They're supposed to come from the origin on the bone they're attached to.
You're right: the vertices' offsets ("translation") come from the parent(!)-bone.

Let's start at bone 0: parent bone is "-1". So you can't translate bone 0 attached vertices. Bone "1" has (e.g.) parent ID "0". So read the vertex-Index of bone 0, take that vertex from the vertex-list and that's your x/y/z-offset for Bone 1 attached vertices. All offsets are relative, not absolute. If you have a branch with bone 0 -> bone 1 -> bone 2, then the vertices of bone 2 are translated by adding the offset of bone 1 and offset of bone 0.

My implementation (LbaBody::translateVertices()) uses recursion. I start at bone 0 and commit the "current offset" to the next bone in the branch recursively. You can ignore the "rotation"-stuff. That's for animation and not needed for basic bone-translation.

Hope this helps!
Reply With Quote