Giter Club home page Giter Club logo

maya-dem-bones's Introduction

maya-dem-bones

This repository contains Maya python bindings for DemBones an implementation of Smooth Skinning Decomposition with Rigid Bones, an automated algorithm to extract the Linear Blend Skinning (LBS) with bone transformations from a set of example meshes. Skinning Decomposition can be used in various tasks:

  • converting any animated mesh sequence, e.g. geometry cache, to LBS, which can be replayed in popular game engines,
  • solving skinning weights from shapes and skeleton poses, e.g. converting blendshapes to LBS,
  • solving bone transformations for a mesh animation given skinning weights.

Installation

  • Extract the content of the .rar file anywhere on disk.
  • Compile python bindings for specific Maya versions.
  • Drag the dem-bones.mel file in Maya to permanently install the script.

Compiling

The compiling of the python bindings can be done on by running the build.bat command specifying the desired maya version. The build.bat scripts expects both Maya and Visual studio to be installed in the default directory. If this is not the case the build.bat file can be edited to make sure it links to files that exist on disk. Currently only windows is supported! Following the steps below will create a pyd file for the specified version of Maya in the build directory. As the build.bat builds an environment specific for the version of maya it is not possible to switch maya versions in the same terminal as the build will error.

  1. Copy the following libraries to their respective folders in /extern:

    • DemBones with path /extern/DemBones/DemBones/Dembones.h,
    • pybind11 with path /extern/pybind11/include/pybind11/pybind11.h,
    • Eigen 3.3.9 with path /extern/Eigen/Eigen/Dense,
  2. Run build.bat

cd path/to/maya-dem-bones
build.bat 2022

Usage

The python bindings only provide partial mapping to the full capabilities of the DemBones project. It takes a mesh with a skin cluster and compute the best possible weights and transforms for the existing skeleton. It is possible to exclude weights via a demLock color set and exclude transform calculation via a demLock boolean attribute on the influence. You can extend the functionality of the class by creating a subclass that will allow you to recreate the animation, drive the helper joints with an RBF network using the newly calculated matrices etc.

import dem_bones

db = dem_bones.DemBones()
db.compute("skinned_MESH", "deformed_MESH", start_frame=1001, end_frame=1010)

print(db.influences)
print(db.weights)
print(db.bind_matrix("jaw_JNT"))
print(db.anim_matrix("jaw_JNT", 1005))

Example

A maya and python file is provided in the /example directory. This maya file contains two meshes and a skeleton. Both meshes are the standard face taken from Apple's ARKit. One of the meshes is driven by a blend shape node which has a shape triggered at each frame. The other is default bound to a skeleton. After running the code contained in the python file the skin weights and joint transformations will be calculated and set them in the scene to match the mesh driven by the blend shape node.

Licenses

  • The source code, /src, uses MIT as detailed in LICENSE.md
  • Any build python bindings /build uses third party libraries: DemBones, pybind11 and Eigen with licenses in 3RDPARTYLICENSES.md

maya-dem-bones's People

Contributors

robertjoosten avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.