Skip to content

Commit 6c9e3a1

Browse files
authored
Fix initialization issue (infinite loop) (#6)
* Fix boundary bug. Add joint orient. * Update readme
1 parent 2ab9b04 commit 6c9e3a1

157 files changed

Lines changed: 12914 additions & 4339 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3RDPARTYLICENSES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ THE SOFTWARE.
409409
## FBXSDK
410410

411411
This software contains Autodesk(R) FBX(R) code developed by Autodesk, Inc.
412-
Copyright 2018 Autodesk, Inc. All rights, reserved. Such code is provided
412+
Copyright 2019 Autodesk, Inc. All rights, reserved. Such code is provided
413413
“as is” and Autodesk, Inc. disclaims any and all warranties, whether express
414414
or implied, including without limitation the implied warranties of
415415
merchantability, fitness for a particular purpose or non-infringement of

CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,21 @@ target_include_directories(DemBonesCmd PUBLIC
4040
target_link_libraries(DemBonesCmd PUBLIC
4141
"${FBXSDK_LIBS}"
4242
"${ALEMBIC_LIBS}"
43-
"${ZLIB_LIBS}"
4443
)
4544

4645
if(WIN32)
47-
find_package(Zlib)
48-
target_link_libraries(DemBonesCmd PUBLIC "${ZLIB_LIBS}")
46+
set_target_properties(DemBonesCmd PROPERTIES LINK_FLAGS "/force:multiple")
47+
install(TARGETS DemBonesCmd DESTINATION "bin/Windows")
48+
elseif(APPLE)
49+
set_target_properties(DemBonesCmd PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
50+
target_link_libraries(DemBonesCmd PUBLIC "-framework CoreFoundation -lxml2 -lz -liconv")
51+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-switch -Wno-return-stack-address")
52+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wno-switch -Wno-return-stack-address")
53+
install(TARGETS DemBonesCmd DESTINATION "bin/MacOS")
54+
else()
55+
target_link_libraries(DemBonesCmd PUBLIC "-lxml2 -lz -ldl")
56+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -D_GLIBCXX_USE_CXX11_ABI=0")
57+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -D_GLIBCXX_USE_CXX11_ABI=0")
58+
install(TARGETS DemBonesCmd DESTINATION "bin/Linux")
4959
endif()
5060

51-
if(APPLE)
52-
set_target_properties(DemBonesCmd PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
53-
target_link_libraries(DemBonesCmd PUBLIC "-framework CoreFoundation")
54-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
55-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
56-
endif()
57-
58-
install(TARGETS DemBonesCmd)

Doxyfile

Lines changed: 2567 additions & 2568 deletions
Large diffs are not rendered by default.

ExtLibs/zlib/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Dem Bones
44
[![BSD3 Clause](https://img.shields.io/badge/license-BSD3_Clause-blue.svg)](LICENSE.md)
5+
[![Version](https://img.shields.io/badge/version-1.1.0-green.svg)](VERSION.md)
56

67
This repository contains an implementation of [Smooth Skinning Decomposition with Rigid Bones](http://binh.graphics/papers/2012sa-ssdr/),
78
an automated algorithm to extract the *Linear Blend Skinning* (LBS) with bone transformations from a set of example meshes.
@@ -14,42 +15,51 @@ This project is named after "The Skeleton Dance" by Super Simple Songs.
1415

1516
## Contents
1617
- `include/DemBones`: C++ header-only core library using [Eigen](http://eigen.tuxfamily.org) and [OpenMP](https://www.openmp.org/). Check out the documentations in [docs/index.html](docs/index.html).
17-
- `bin`: pre-compiled command line tools for Windows and MacOS that read and write [FBX](https://www.autodesk.com/products/fbx/overview) and [Alembic](https://www.alembic.io/) files. Check out the usage by running `DemBones --help`.
18+
- `bin`: pre-compiled command line tools for Windows, Linux, and MacOS that read and write [FBX](https://www.autodesk.com/products/fbx/overview) and [Alembic](https://www.alembic.io/) files. Check out the usage by running `DemBones --help`.
1819
- `src/command`: source code for the command line tool. Check out `AbcReader.cpp`, `FbxReader.cpp`, and `FbxWriter.cpp` for the usage of the core library.
19-
- `data`: input/output test data for the command line tool. Run and check out the scripts `run.bat` (Windows) or `./run.sh` (MacOS).
20+
- `data`: input/output test data for the command line tool. Run and check out the scripts `run.bat` (Windows) or `./run.sh` (Linux/MacOS).
2021

2122
## Compiling
2223
Tested platforms:
23-
- Visual Studio 2019 on Windows 10 x64,
24-
- LLVM 9.0.0 (Homebrew) on MacOS 10.13.6 x64 (experimental).
24+
- Visual Studio 2019 on Windows 10 x64
25+
- g++ 9.3.0 on Ubuntu Linux 20.14
26+
- LLVM 10.0.0 (Homebrew) on MacOS 10.13.6
2527

2628
Compiling steps:
27-
1. Install [cmake 3.15](https://cmake.org/)
29+
1. Install [cmake](https://cmake.org/)
2830
2. Copy the following libraries to their respective folders in `ExtLibs` so that [cmake](https://cmake.org/) can find these paths:
2931
- [Eigen 3.3.7](https://eigen.tuxfamily.org/) with path `ExtLibs/Eigen/Eigen/Dense`,
30-
- [Alembic (from Maya 2019 DevKit)](https://www.autodesk.com/developer-network/platform-technologies/maya) with path `ExtLibs/Alembic/include/Alembic/Abc/All.h`,
31-
- [FBXSDK 2019.0](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2019-0) with path `ExtLibs/FBXSDK/include/fbxsdk.h`,
32+
- [Alembic (from Maya 2020 Update 2 DevKit)](https://www.autodesk.com/developer-network/platform-technologies/maya) with path `ExtLibs/Alembic/include/Alembic/Abc/All.h`,
33+
- [FBXSDK 2020.0.1](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0) with path `ExtLibs/FBXSDK/include/fbxsdk.h`,
3234
- [tclap 1.2.2](http://tclap.sourceforge.net/) with path `ExtLibs/tclap/include/tclap/CmdLine.h`,
33-
- **For Windows only:** [zlib (from Maya 2019 DevKit)](https://www.autodesk.com/developer-network/platform-technologies/maya) with path `ExtLibs/zlib/zlib.lib`.
34-
3. Run:
35+
3. Run cmake:
3536
```
3637
mkdir build
3738
cd build
3839
cmake ..
3940
```
40-
4. For Windows, launch and compile the solution `dem-bones.sln` with Visual Studio. For MacOS, run `$ make install`
41-
42-
> **Note for MacOS**
43-
> - Apple Clang (default compiler) does not support OpenMP and Eigen. We recommend using [LLVM](https://formulae.brew.sh/formula/llvm).
44-
> Assuming LLVM is installed in the default path: `/usr/local/opt/llvm/bin`, instead of `cmake ..`, you can run:
45-
> ```
46-
> $ cmake -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ ..
47-
> ```
48-
> - The pre-compiled tool `bin/DemBones` requires dynamic [libomp for LLVM](https://openmp.llvm.org/). If you have an error messeage related to OpenMP,
49-
> please install `libomp`, e.g. with [Homebrew](https://brew.sh/) using `$ brew install libomp`.
50-
> - `bin/DemBones` was compiled with the optimization flag `-O3`. It looks like LLVM uses [fast math](http://eigen.tuxfamily.org/bz/show_bug.cgi?id=950)
51-
> so the results are slightly different with those generated by Windows version.
52-
> Removing optimization flags (in `CMakeLists.txt`) helps to reproduce the same results with Windows version but the tool will run 10x slower.
41+
4. Build: `$ cmake --build . --config Release --target install`
42+
43+
> **Notes for Linux**
44+
> - You may need to install some libriries: [libxml2-dev](http://xmlsoft.org/) (run `$ sudo apt-get install libxml2-dev`) and [zlib-dev](https://zlib.net/) (run `$ sudo apt-get install zlib1g-dev`).
45+
>
46+
> - `bin/Linux/DemBones` was compiled with flag [`-D_GLIBCXX_USE_CXX11_ABI=0`](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html)
47+
> for compatibility with the pre-complied [Alembic (from Maya 2020 Update 2 DevKit)](https://www.autodesk.com/developer-network/platform-technologies/maya).
48+
>
49+
> **Notes for MacOS**
50+
> - Apple Clang (default compiler) does not support OpenMP and Eigen. We recommend using [LLVM](https://formulae.brew.sh/formula/llvm).
51+
> Assuming LLVM is installed in the default path: `/usr/local/opt/llvm/bin`, instead of `cmake ..`, you can run:
52+
> ```
53+
> $ cmake -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ ..
54+
> ```
55+
>
56+
> - The pre-compiled tool `bin/DemBones` requires dynamic [libomp for LLVM](https://openmp.llvm.org/). If you have an error messeage related to OpenMP,
57+
> please install `libomp`, e.g. with [Homebrew](https://brew.sh/) using `$ brew install libomp`.
58+
>
59+
> - `bin/MacOS/DemBones` was compiled with the optimization flag `-O3`. It looks like LLVM uses [fast math](http://eigen.tuxfamily.org/bz/show_bug.cgi?id=950)
60+
> so the results are slightly different with those generated by Windows version.
61+
> Removing optimization flags (in `CMakeLists.txt`) helps to reproduce the same results with Windows version but the tool will run 10x slower.
62+
5363
5464
## References
5565
@@ -76,12 +86,12 @@ The skinning weights smoothing regularization was published in the paper:
7686
7787
## Authors
7888
79-
> <p align="center"><a href="https://seed.ea.com"><img src="logo/SEED.jpg" width="150px"></a><br><b>Search for Extraordinary Experiences Division (SEED) - Electronic Arts <br> http://seed.ea.com</b></p>
80-
> We are a cross-disciplinary team within EA Worldwide Studios. Our mission is to explore, build and help define the future of interactive entertainment.
81-
82-
Dem Bones was created by Binh Le (ble@ea.com).
89+
<p align="center"><a href="https://seed.ea.com"><img src="logo/SEED.jpg" width="150px"></a><br>
90+
<b>Search for Extraordinary Experiences Division (SEED) - Electronic Arts <br> http://seed.ea.com</b><br>
91+
We are a cross-disciplinary team within EA Worldwide Studios.<br>
92+
Our mission is to explore, build and help define the future of interactive entertainment.</p>
8393
84-
The [logo](logo/DemBones.png) was designed by Phuong Le.
94+
Dem Bones was created by Binh Le (ble@ea.com). The [logo](logo/DemBones.png) was designed by Phuong Le.
8595
8696
## Contributing
8797

VERSION.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Version History
2+
3+
## Version 1.1.0 (June 2020)
4+
- Add per-bone transformation hard-lock and per-vertex weights soft-lock
5+
- Fix initialization issue on cluster splitting
6+
- Support joint orientation in command line tools
7+
- Add command line tool for Linux
8+
- FBXSDK 2020, Alembic (from Maya 2020 DevKit)
9+
10+
## Version 1.0.1 (Dec 2019)
11+
- Add DemBonesExt default constructor
12+
13+
## Version 1.0.0 (Oct 2019)
14+
- FBXSDK 2019, Alembic (from Maya 2019 DevKit)
15+
- Command line tools for Windows and MacOS
Binary file not shown.
Binary file not shown.

bin/Windows/DemBones.exe

10.1 MB
Binary file not shown.

bin/usage.txt

Lines changed: 86 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,86 @@
1-
2-
USAGE:
3-
4-
DemBones -a=<filename> ... -i=<filename> ... -o=<filename> ...
5-
[-b=<int>] [--nInitIters=<int>] [-n=<int>]
6-
[--nTransIters=<int>] [--bindUpdate=<int>]
7-
[--transAffine=<double>] [--transAffineNorm=<double>]
8-
[--nWeightsIters=<int>] [-z=<int>] [--weightsSmooth=<double>]
9-
[--weightsSmoothStep=<double>] [--dbg=<int>]
10-
[--log=<filename>] [--] [--version] [-h]
11-
12-
13-
Where:
14-
15-
-a=<filename>, --abc=<filename> (accepted multiple times)
16-
(required) animated mesh sequences (alembic geometry cache files)
17-
18-
-i=<filename>, --init=<filename> (accepted multiple times)
19-
(required) rest pose/init skin clusters (fbx files), each file
20-
correspond to one abc file
21-
22-
-o=<filename>, --out=<filename> (accepted multiple times)
23-
(required) output (fbx files), each outut correspond to one abc file
24-
25-
-b=<int>, --nBones=<int>
26-
number of bones
27-
28-
--nInitIters=<int>
29-
number iterations per init cluster splitting
30-
31-
-n=<int>, --nIters=<int>
32-
number of global iterations
33-
34-
--nTransIters=<int>
35-
number of transformation update iterations per global iteration
36-
37-
--bindUpdate=<int>
38-
update bind pose (0=no update, 1=update joint positions)
39-
40-
--transAffine=<double>
41-
bone translations affinity soft constraint
42-
43-
--transAffineNorm=<double>
44-
p-Norm for bone translations affinity
45-
46-
--nWeightsIters=<int>
47-
number of weights update iterations per global iteration
48-
49-
-z=<int>, --nnz=<int>
50-
number of non-zero weights per vertex
51-
52-
--weightsSmooth=<double>
53-
weights smoothness soft constraint
54-
55-
--weightsSmoothStep=<double>
56-
step size for the weights smoothness
57-
58-
--dbg=<int>
59-
debug level
60-
61-
--log=<filename>
62-
log file name
63-
64-
--, --ignore_rest
65-
Ignores the rest of the labeled arguments following this flag.
66-
67-
--version
68-
Displays version information and exits.
69-
70-
-h, --help
71-
Displays usage information and exits.
72-
73-
74-
Dem Bones - (c) Electronic Arts 2019
75-
76-
Note: this tool only handles clean input data, i.e. only one piece of
77-
geometry with one skinCluster and no excessive joint.
78-
1+
2+
USAGE:
3+
4+
DemBones -a=<filename> ... -i=<filename> ... -o=<filename> ...
5+
[-b=<int>] [--nInitIters=<int>] [-n=<int>]
6+
[--nTransIters=<int>] [--bindUpdate=<int>]
7+
[--transAffine=<double>] [--transAffineNorm=<double>]
8+
[--nWeightsIters=<int>] [-z=<int>] [--weightsSmooth=<double>]
9+
[--weightsSmoothStep=<double>] [--dbg=<int>]
10+
[--log=<filename>] [--] [--version] [-h]
11+
12+
13+
Where:
14+
15+
-a=<filename>, --abc=<filename> (accepted multiple times)
16+
(required) animated mesh sequences (alembic geometry cache files)
17+
18+
-i=<filename>, --init=<filename> (accepted multiple times)
19+
(required) rest pose/init skin clusters (fbx files), each file
20+
correspond to one abc file
21+
22+
-o=<filename>, --out=<filename> (accepted multiple times)
23+
(required) output (fbx files), each outut correspond to one abc file
24+
25+
-b=<int>, --nBones=<int>
26+
number of bones
27+
28+
--nInitIters=<int>
29+
number iterations per init cluster splitting
30+
31+
-n=<int>, --nIters=<int>
32+
number of global iterations
33+
34+
--nTransIters=<int>
35+
number of transformation update iterations per global iteration
36+
37+
--bindUpdate=<int>
38+
update bind pose (0=no update, 1=update joint positions)
39+
40+
--transAffine=<double>
41+
bone translations affinity soft constraint
42+
43+
--transAffineNorm=<double>
44+
p-Norm for bone translations affinity
45+
46+
--nWeightsIters=<int>
47+
number of weights update iterations per global iteration
48+
49+
-z=<int>, --nnz=<int>
50+
number of non-zero weights per vertex
51+
52+
--weightsSmooth=<double>
53+
weights smoothness soft constraint
54+
55+
--weightsSmoothStep=<double>
56+
step size for the weights smoothness
57+
58+
--dbg=<int>
59+
debug level
60+
61+
--log=<filename>
62+
log file name
63+
64+
--, --ignore_rest
65+
Ignores the rest of the labeled arguments following this flag.
66+
67+
--version
68+
Displays version information and exits.
69+
70+
-h, --help
71+
Displays usage information and exits.
72+
73+
74+
Dem Bones - (c) Electronic Arts 2019
75+
76+
- This tool only handles clean input data, i.e. only one piece of
77+
geometry with one skinCluster and no excessive joint.
78+
79+
- To hard-lock the transformations of bones: in the input fbx files,
80+
create bool attributes for joint nodes (bones) with name "demLock" and
81+
set the value to "true".
82+
83+
- To soft-lock skinning weights of vertices: in the input fbx files,
84+
paint per-vertex colors in gray-scale. The closer the color to white,
85+
the more skinning weights of the vertex are preserved.
86+

0 commit comments

Comments
 (0)