Giter Club home page Giter Club logo

deformation-transfer-for-triangle-meshes's Introduction

Python: "Deformation Transfer for Triangle Meshes"

A Python implementation of the paper "Deformation Transfer for Triangle Meshes" by Sumner, Popović with 3D views in the browser.

alt text

TL; DR

The goal is to transfer animations (deformations) from one model (source) to any other model (target) which does not share the same vertices count.

The core idea is to describe the linear problems as position-independent triangle transformations (triangle span + normal).

First a correspondence mapping between the source and target reference models is created by progressively "inflating" the source shape into the target shape. Each step minimizes the cost of the triangle transformation of the source mesh while pinning the user-provided marker vertices to the target mesh. Iteratively closest points are selected and increasingly weighted in the cost function.

The deformation transfer is the minimum solution of the Frobenius distance between the triangle transformations (source🠊deformed-source, target🠊deformed-target) for each mapped triangle pairs.

  • "Pinning": The markers are already solved and moved to the right side of Ax=b.
  • "Frobenius norm": Very useful matrix norm that is invariant to matrix equation rearrangements.

Examples

There are online interactive renders at: https://mickare.github.io/Deformation-Transfer-for-Triangle-Meshes/

How it works

  1. Build correspondence mapping
    1. Iterate n number of times:
      1. Solve minimum cost of the source mesh transformation with the markers pinned to the target mesh alt text
        • ES: Smoothness cost, EI: Identity cost, EC: Clostest-point cost
      2. Find closest point on target mesh for each source vertice
      3. Increase weight wC of closest-point cost function
    2. Find matching triangles via triangle centroids and orientation alt text
  2. Transfer deformation
    • Solve minimum of the Frobenius distance between the transformations of source to deformed source and of the target to the unknown deformed target. alt text
      • M: mappings, SSj: j'th triangle transformation of source, Ttj: j'th triangle transformation of target, ˜v: vertices of the deformed target
    • The deformed target is the objective of the minimization.

Requirements

Python >= 3.9

Pip-Requirements:

  • pip install -r requirements.txt

Usage

Each part of the .py files can be run by themself to visualize the results of each component.

For simplification none accepts command arguments. You'll have to modify the "main" yourself to change for example the used model.

File Description Main
correspondence.py Create the correspondence mapping. Will plot each step of the correspondence.
transformation.py Use a mapping to transfer a deformation Will plot the result of the transformation
animation.py Plots an animation for all deformations for a model.
export.py Exports each step of correspondence, transformation and the animation to a html page.
config.py Default configuration and file paths to markers and models.

Helper

File Main
render/plot_marker.py Plots the markers for two models.

Contributors

License

The code in this repository is licensed under the MIT License.

The models are each licensed from a third party and are not part of this license! You should NOT distribute or use these models against their license. A list of the used model licenses and source is under models/.

deformation-transfer-for-triangle-meshes's People

Contributors

corianderaberdeen avatar mickare 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.