GithubHelp home page GithubHelp logo

adamnemecek / dualquaternionskinning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ishmeetkohli/dualquaternionskinning

0.0 1.0 0.0 6.95 MB

Skeletal Animation with Dual Quaternion Skinning and Linear Blend Skinning

Java 95.13% GLSL 4.87%

dualquaternionskinning's Introduction

Dual Quaternion Skinning

Skeletal Animation with Dual Quaternion Skinning and Linear Blend Skinning

Abstract

Skinning refers to an animation technique where a model is animated using a skeleton (primarily when a vertex may be influenced by more than one bone). The Process of creating a hierarchical set of interconnected bones called skeleton or a rig is called Rigging.

For real-time animation of deformable models, skinning is an important aspect to give the look and feel of a real character to the model. The standard method that is used for skinning is the Linear Blend Skinning, although it is very simple and effective in most cases, there are cases where it produces errors like loss of volume, candy wrapper artifacts and unrealistic looking edges. To solve these problems, we can use an enhanced version of skinning method called Dual Quaternion skinning which is not too complex as related to Linear Blend skinning but produces much better results.

Candy Wrapper Artifact

Introduction

In some of the animation applications we need to have very accurate skin mapping and manipulation, but in some other applications like video games, a fast algorithm is needed for skinning multiple models rapidly which is the reason for devoting our time to Dual Quaternion skinning. I will be implenting Dual quaternion skinning in this project and will be applying it to deform one of the human models and try to improve on its efficiency.

Benefits of Dual quaternion skinning includes that it is not as complex as more advanced skinning methods, almost as efficient as LBS and the same environment as used for LBS can be used.

Literature Review

There has been much work done in this field, although people have employed different methods to solve this problem , the major umbrellas that these techniques fall under include : physically based models, capturing real subsets, example based techniques and Geometric methods.

The technique I will be employing : Dual Quaternion Skinning, falls under Geometric methods and I will be following a paper by Ladislav Kavan et.al called “Skinning with Dual Quaternions”.

Understanding Dual Quaternions

Dual Quaternion mathematics is similar to normal Quaternions but it is different from them because dual quaternions contains two quaternion one which is simple and the other considered as dual part.

A Dual Quaternion

They can represent both translation and rotation at the same time and hence a complete Rigid body transformation can be represented by a Dual Quaternion

Method

I will first try to implement Linear blend skinning and see its results and limitations. When I am done, I will improve my method to implement Dual Quaternion skinning. I am planning to further split this whole process into phases as well, ie , firstly I will try to implement skinning on a basic primitive object, then extend it to cover a very basic human model and then move on to a complex model.

Rigging

I will first have to create a skeleton or bone model for the model and assign weights to individual parts of the body, and then only I can apply the skinning process by blending the skin texture with respect to the bone/joint being moved.

Data Structures and algorithms

We will use mathematical objects called Dual Quaternions instead of using matrices to express the motions of the joints. With Quaternions we can express 3D rotations as we would do with a 3x3 matrix and with Dual Quaternions we can express a rotation and a translation like a 4x4 matrix.

Skinning process

Convert all the transformation matrices (4X4) of the bones/joints representing both rotation and transformation to dual quaternions. I did this on the CPU and sent them to GPU in 4x4 matrices using just the first 2 rows. Then we can compute the deformed position of a vertex with DQS by this formula:

Formula for calculating vertex position

I calculated these values for vertices and normals in the vertex shader.

Order of Tasks Done

Rigging a basic cylinder

Since complete skinning is a complex process, I thought of starting with a basic cylinder and then extending upon it. I created a basic 3D cylinder in blender and started attaching armatures and bones to it, to rig it as shown in figure 5.

A Rigged Cylinder

Applying Linear Blend Skinning on a basic cylinder

I created the basic building blocks of my openGL implementation with parts to handle the world and the camera visualizations and started working on implementing Linear Blend Skinning. Implementing LBS on the GPU (shaders) was not that hard and I was easily able to to that as shown in figure 6.

A Skinned Cylinder

Applying Dual Quaternion on a basic cylinder

Implementing DQS was very tough and I took many days to figure out the whole algorithm. I was finally able to implemented it and its working almost correctly. I need to make some changes to the shader code for DQS to make it better but I am leaving that for later as I want to move to the next step since I am already lagging behind as per my original schedule.

Rigging a complex model

I used blender to rig my model and played around with the bones to produce a keyframe animation and finally exported it to a collada(.dae) format to be used up by my program. The model that I rigged in blender is shown with all the bones and their heirarchy in figure 7.

A Rigged Human Model

Project Structure

I used Java’s OpenGL implementation to implement my project. A Collada parser was used to parse models and its animations from a collada(.dae file) to be used up in the project.The names and brief introduction of most of the moving parts in the project is shown in figure.

Project Structure

Conclusions

I have implemented both LBS and DQS in Java’s OpenGL implementation. The basic cylinder skinned using DQS did not exhibit candy wrapper issue when rotated from the middle as it were portrayed by the cylinder skinned using LBS.

Also for the human figure skinned using DQS, there was an axis change in the final rigged model, ie, whatever was translated in Y-axis in the rigging software(blender here) started translating in the Z-axis or vice versa after feeding the exported animation to my skinning program. On further investigation, I found that this was happening due to the fact that I am exporting my .DAE file from blender and blender switches the axis Y and axis Z as compared to some of the other industry standards. I was not able to find a way to stop blender from doing this while the export.

dualquaternionskinning's People

Contributors

ishmeetkohli avatar

Watchers

 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.