Closed lucasjinreal closed 2 years ago
Wow...it's really hard to deal with model files.
If you built it yourself
What compiler did you use?
And I forgot to update the README.md. Did you ever use --recursive when cloning?
Here's what I just built from the main branch.... with gcc10.3.0 x86_64-w64-mingw32 (windows11)
I will build and test it in various environments. Thanks for the issue!
@Nor-s I am on macOS with clang 11.3.
which assimp version did u using? I using assimp updated to this commit: abfb26ab6f2b350d604ad1e653250c998579c41f
the only differences between you and me should be assimp, since I am not using your submodule commit id, I can not pull it due to poor network speed in China behind GFW, so I just cloned it with master branch.
Can u try update to master assimp master branch? it should have some bias between our two sides.
This also seems to be a flag issue!
I tested it with the assimp (abfb26ab6f2b350d604ad1e653250c998579c41f) on Mac OS with clang12 and it was normal.
However
I was able to reproduce the error by setting the assimp's flags as follows:
AssimpAnimation(const char *animation_path)
{
type = AnimationType::Assimp;
Assimp::Importer importer;
unsigned int assimp_read_flag =
aiProcess_SortByPType |
aiProcess_ConvertToLeftHanded |
aiProcess_ValidateDataStructure |
aiProcess_LimitBoneWeights;
Try adding it to AssimpAnimation
aiProcess_ConvertToLeftHanded |
I'm not sure why the results are different depending on the environment,, but if you use that flag in code, it might work.
@Nor-s I didn't change the code, should be same as yours. let me have a try, if your code same as mine, I maybe should using aiProcess_ConvertToRightHanded
to inverse it again, which is really strange.
@Nor-s Hi, I am uncomment that flag (it was just comment out when clone), not it looks lack some mesh:
the flags:
Assimp::Importer import;
unsigned int assimp_read_flag = aiProcess_Triangulate |
aiProcess_SortByPType |
aiProcess_GenUVCoords |
aiProcess_OptimizeMeshes |
aiProcess_ValidateDataStructure |
aiProcess_ConvertToLeftHanded |
// aiProcess_FlipUVs |
aiProcess_GenNormals |
aiProcess_CalcTangentSpace;
assimp_read_flag |= aiProcess_LimitBoneWeights;
assimp_read_flag |= aiProcess_JoinIdenticalVertices;
assimp_read_flag |= aiProcess_FlipWindingOrder;
import.SetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, false);
@jinfagang You need to modify the AssimpAnimation class.
not model.cpp
@Nor-s thanks for the info, will try it later. But I have a question, doesn't fbx animation baked in? Why there should another reading process for the animation?
@jinfagang
There was no other reason. The reference I saw when I was learning the skeleton was just such a structure.
In my opinion, this structure has the advantage of being easy to implement. It also makes the animation model independent. Therefore, if you register an animation, you can use it in all models. (As long as the models have the same binding pose structure. Note that some Mixamo models have different binding poses.)
But I think it would be better to put them together.
So, in the future, I'm going to have an import manager and create a system that combines the two processes and manages resources.
@Nor-s thanks, after your explaination, i now though depart them from each other could be better. SO that animations with BVH and model with FBX can be work out of box.
Will catch u up with this project!
BTW, I found I can not using the camera (touchpad in mac) can not freely turn around the model, is it normal?
I tried edit animation class, but the result still not right:
and the texture seems not right as well.
models.cpp:
unsigned int assimp_read_flag = aiProcess_Triangulate |
aiProcess_SortByPType |
aiProcess_GenUVCoords |
aiProcess_OptimizeMeshes |
aiProcess_ValidateDataStructure |
// aiProcess_ConvertToLeftHanded |
aiProcess_FlipUVs |
aiProcess_GenNormals |
aiProcess_CalcTangentSpace;
assimp_read_flag |= aiProcess_LimitBoneWeights;
assimp_read_flag |= aiProcess_JoinIdenticalVertices;
assimp_read_flag |= aiProcess_FlipWindingOrder;
import.SetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, false);
animation.cpp
unsigned int assimp_read_flag =
aiProcess_SortByPType |
aiProcess_ValidateDataStructure |
aiProcess_ConvertToLeftHanded |
aiProcess_LimitBoneWeights;
importer.SetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, false);
why it was so not right?
the mesh also cavity.
@Nor-s all right, now I reset all flags, except adding a ConvertToLeft hand in animation. now it looks like this:
as you can see, the animation now looks a little bit normal, but still not right, the leg, are opossited I think. it was un natural.
why?
@jinfagang i dont know... sorry
But try setting this flag on model load as well. The reason it looks like this is probably because the coordinate system of the model nodes does not change. (It looks like the left and right are reversed because only the animation has changed)
Try the following: aiProcess_MakeLeftHanded |
(model or animation)
(I found out later that the 'ConvertToLeft' option sets various things. So try MakeLeftHanded
as well. instead CovertToLeft..)
//this is shortcut flag for Direct3D-based applications)
#define aiProcee_CovertToLeft aiProcess_MakeLeftHanded | aiProcess_FlipUVs | aiProcess_FlipWindingOrdel| 0
If that doesn't work, check out the next project. These projects also looked fine to me for animation with assimp.
https://github.com/diharaw/animation-system
https://github.com/emeiri/ogldev/tree/master/tutorial28_youtube
And I'm not sure about the camera rotation. It works fine on my macbook m1. (But moving the camera forward is slow, because I haven't set that part up for the mixamo model yet.)
I'm really sorry that I haven't been able to help again.
@Nor-s thanks, I will try aiProcess_MakeLeftHanded
later.
why does the system platform will effect the animation loading way? it didn't make sense. Have u tried download some mixamo fbx model file and visualize?
i find model error but this model
But This model gave an error even when I run it on Blender.
And if the model texture has an alpha value, the model may not be visible.
@Nor-s are u tested on macos? the only difference between you and me is system.
@jinfagang I really don't know why. It works fine on my macbook.
@Nor-s I am trying build pixe3d on a ubuntu, see if this platform is normal. I will clone a fresh repo to start.
@jinfagang Since I have never built in Ubuntu environment, I will also try it in wsl2 ubuntu environment.
Also, if you are using gcc12 assimp will not build so you may need to install a different version.
wsl2 Ubuntu 20.04.4 LTS (Focal Fossa) gcc 9.4.0 x86_64-linux-gnu
sudo apt install wget
sudo apt install openssl
sudo apt install ninja-build
sudo apt-get install build-essential libgtk-3-dev
sudo apt-get install libxinerama-dev
sudo apt install libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2.tar.gz
tar -xvf cmake-3.23.2.tar.gz
cd cmake-3.23.2
./bootstrap --prefix=/usr
make
sudo make install
project(
n-glcpp
LANGUAGES CXX
VERSION 0.0.5)
set(CMAKE_CXX_STANDARD 17)
if (UNIX AND NOT APPLE)
set(CMAKE_MAKE_PROGRAM /usr/bin/ninja CACHE FILEPATH "")
endif()
git clone --recursive https://github.com/Nor-s/Pixel3D.git
cd Pixel3D
mkdir build
cd build
cmake .. -G Ninja
ninja
However, the models have not been tested yet.
the bones seems opposite, all fbx are same behavior.
and this was:
default zombies also seems oppsited: