Exporting a skeleton to NVIDIA Kimodo

   309   0   2
User Avatar
Member
49 posts
Joined: 12月 2014
オフライン
Hey guys,

So i've been testing out NVIDA Kimodo and I've been trying to take a skeleton and export it from Houdini back into Kimodo as constraints. However for the life of me I cannot get the skeleton to output the right joint orientation for Kimodo. So I was wondering if anyone has had better luck with it.

The rest pose skeleton i'm using in Houdini is a weird amalgamation of using an outputted T-pose .bvh file from Kimodo for the joint name order and position and converting the kimodo\Lib\site-packages\kimodo\assets\skeletons\somaskel77\standard_t_pose_global_offsets_rots.pto a json for the transforms. I've done this as I suspect the .bvh file is converting the orientations so I'm assuming getting the raw transforms that are what kimodo use would give me the correct joint orientations. HOWEVER I'm getting better results simply having zero transforms...

After that I'm computing the local transforms then a rigpose to make a pose and in a wrangle creating the s@local_joints_rot with this.

v[]@local_joints_rot;
for(int pnt=0; pnt<npoints(1); pnt++){
    matrix rest_xform = point(1, "localtransform", pnt);
    matrix xform = point(0, "localtransform", pnt);
    xform = invert(rest_xform) * xform;
    //xform *= invert(rest_xform);
    vector local_rad = cracktransform(0, 0, 4, 0, xform);
    append(v[]@local_joints_rot, local_rad);
}

int hip_pnt = findattribval(0, "point", "name", "Hips");
v@root_positions = point(0, "P", hip_pnt);
u@smooth_root_2d = set(v@root_positions[0], v@root_positions[2]);
i@frame = 0;

Then I'm converting that node into a constraint json file for kimodo to read.
import hou
import json


def export():
    node = hou.selectedNodes()[0]
    geo = node.geometry()
    frame_indices = []
    local_joints_rots = []
    root_positions = []
    smooth_root_2d = []

    frame_indices.append(geo.intAttribValue("frame"))
    local_joints_rot_raw = geo.floatListAttribValue("local_joints_rot")
    ls = []
    for b in range(0, len(local_joints_rot_raw), 3):
        local_rot = local_joints_rot_raw[b:b + 3]
        ls.append(local_rot)
    local_joints_rots.append(ls)
    root_positions.append(geo.floatListAttribValue("root_positions"))
    smooth_root_2d.append(geo.floatListAttribValue("smooth_root_2d"))
    constraints_d = {
        "type": "fullbody",
        "frame_indices": frame_indices,
        "local_joints_rot": local_joints_rots,
        "root_positions": root_positions,
        "smooth_root_2d": smooth_root_2d
    }
    file_path = hou.ui.selectFile(chooser_mode=hou.fileChooserMode.Write, pattern="*.json")
    if file_path == "":
        return
    file_path = hou.text.expandString(file_path)
    if not file_path.endswith(".json"):
        file_path += ".json"

    json_str = json.dumps([constraints_d], indent=4)
    with open(file_path, "w") as f:
        f.write(json_str)


export()

I've messed with the rotation order but it doesn't seem to work. I get close but never exact and it's driving me nuts. My knowledge/ understanding of matrix's is very limited.



Image Not Found

Image Not Found
Edited by JohnDoe777 - 2026年4月11日 13:35:35

Attachments:
example_001.hip (254.3 KB)
standard_t_pose_global_offsets_rots.json (28.8 KB)

  • Quick Links