GithubHelp home page GithubHelp logo

piercelbrooks / bvhparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peterhyun/bvhparser

0.0 0.0 0.0 2.05 MB

This program parses a BVH file to an OpenGL animation, which is made by OpenGL version 3.3, GLFW3

C++ 89.73% CMake 7.85% GLSL 2.41%

bvhparser's Introduction

BVHParser

September 2018 Jeehon Hyun

This is a simple BVH Parser & Player based on OpenGL and GLFW.

Demo

https://www.youtube.com/watch?v=dTTWGeY6J64

How to build and run.

  1. Download this repository and go to the BVHParser/Build directory.
git clone --recursive https://github.com/peterhyun/BVHParser.git
cd BVHParser
cd Build

If you forgot to use the --recursive flag while cloning this repository, use the following line to update the submodules:
git submodule update --init

  1. Make a project/solution file or makefile depending on your platform. I used Microsoft Windows, Visual Studio 2019.
# UNIX Makefile
cmake ..

# Mac OSX
cmake -G "Xcode" ..

# Microsoft Windows
cmake -G "Visual Studio 16 2019" ..
...
  1. Build the project on your platform accordingly.

While building in the Visual Studio 2019 IDE, Treat Warning As Errors had to be unticked in the project file property settings for building the Assimp library. DoNotTreatWarningAsErrors

  1. Go to the directory Build/Glitter/Debug run the produced executable file with with the bvh file name you want to load as the command line argument. ./Glitter $(bvh file name).bvh

Directory Structure & Explanation

.
├── Build/
├── Glitter/
│ ├── Assets/
│ │ ├── README
│ │ ├── Trial001.bvh
│ │ ├── Trial002.bvh
│ │ └── Trial004.bvh
│ ├── Headers/
│ │ ├── BVHParser.h
│ │ ├── BoneForMotionData.h
│ │ ├── Camera.h
│ │ └── Shader.h
│ ├── Shaders/
│ │ ├── AnimationVertexShader.vs
│ │ └── AnimationFragmentShader.fs
│ ├── Sources/
│ │ └── MotionCapture.cpp
│ └── Vendor/
├── screenshots/
├── CMakeLists.txt
└── Readme.md

A BVH file is written in a tree structure, where the pelvis bone is usually the root node. The BVHParser class implemented in BVHParser.h parses this file into a tree structure, where each node data is stored in Bone instances whose class is written in BoneForMotionData.h. Furthermore, BVHParser also stores all the frame data of all nodes in its 1D motion array sequentially. So when actually using the data for rendering, the program will then read a certain segment of this array for the corresponding frame and bone. BVHParser also uses a DFS (Depth-First-Search) approach to calculate a child node's global transformation matrix starting from the root node. This approach can be observed in BVHParser::setMotion.

The vertex shader and fragment shader are simple glsl code used to render the green model on screen, so I won't go over it here.

Acknowledgement

The basic OpenGL Setup boilerplate of this code is from Kevin Fung's Glitter repository: https://github.com/Polytonic/Glitter With this boilerplate, you can test this code in Windows, Linux, or Mac environment. The only dependency it requires is CMake.


MIT License of the Glitter Boilerplate

The MIT License (MIT)

Copyright (c) 2015 Kevin Fung

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bvhparser's People

Contributors

domesticmouse avatar jlopezr avatar peterhyun avatar polytonic avatar romanlevin 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.