Giter Club home page Giter Club logo

three-model-animation's Introduction

three-model-animation

Three.js system for FBX model animation and interaction. three-gltf-animation_640x512_24fps

The challenge was to convert animations involving movement (walk-to-stand, walk-loop, etc) into treadmill animations while still keeping the nuances of the original animator's work (the cat model was downloaded from Turbosquid). This required these steps:

  • Extract relevant position and quaternion tracks from FBX model, setting the model's tracks to zero.
  • Using Three.js' VectorKeyframeTrack and QuaternionKeyframeTrack to emulate the AnimationAction's interpolation method (specifically, InterpolantFactoryMethodLinear).
  • Creating Position and Quaternion methods to update the cat model's parent mesh (cat modal is added to a THREE.Group()).

The reasons for developing this 'track extraction' method are two-fold:

  • Updating the cat model's position at the end of each loop felt clunky. I had to wait until the subsequent animation started and then do the update (if not, the cat would jump back to the start of the previous cycle before moving to its new position).
  • I want the cat to be able to walk to a specific position (user places a bowl of cat food and cat walks to it). The cat model has 45, 90, and 180 degree turn animations. These can be used to point the cat in the general direction. Ideally, as the cat is walking toward the bowel, any 'course correction' needed could be applied using a relatively subtle arc while the walk loop is in motion (slightly rotating the model with each frame until it has lined up with the bowl). For this use case, having the position and quaternion tracks separate from the model animation makes controlling the cat a bit more intuitive for the developer.

Note: using FBX because GLTF results in the first frame of the animation duplicated and placed at the end (added by Three.js for a smoother looping animation).

Running Locally

Make sure you have Node.js installed.

git clone https://github.com/patrick-s-young/three-model-animation.git # or clone your own fork
cd three-model-animation
npm install
npm start

Built With

  • Three.js - An easy to use, lightweight, cross-browser, general purpose 3D library.
  • webpack - static module builder.
  • Turbosquid - 3D characters, skeletal rigs, and animations.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

three-model-animation's People

Contributors

patrick-s-young avatar patrick-y-pokeratlas avatar

Watchers

 avatar

Forkers

pi-sulaiman

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.