-
-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: AssImp orientation, imported material color fallback, and set default animation preview model #2291
fix: AssImp orientation, imported material color fallback, and set default animation preview model #2291
Conversation
ah ok, I should have looked closer at Noahs original PR. I see there was already a method for checking the upaxis specifically in this commit. 6c0d92a#diff-9bea816328a0761b726b259bbe8cfd7c4dde5b31dcb1a2e98e8d27ce1f39792cR128 |
Seems like those methods were removed at some point in the PR and the method I have seems to change nothing. I think its because the metadata is the same so I think Im missing something. Adding the files to the description above if someone else would like to test. |
Hi Doprez, sorry for late response, it should automatically take into account source axis system to LHS. which is Stride default! @Doprez |
@Noah7071 No problem at all. so that would be what fixed this right? Because I think the problem is different than the LHS that Stride uses. in this issue people were having similar problems due to FBX metadata which is where I got the Thank you for confirming btw. I think you are one of the very few people who have delved deep into this importer 😄 |
@Doprez I'm out of time to help look further into this at the moment, but here's what I can tell from what you've provided.
I downloaded In the FBX explorer, both files have the same Up/Front/Coord Axis so no root correction applies to these meshes. The working FBX only has one Model (and it's 'A' type for scaling/rotation) I don't understand the importer enough, it seems either I'm placing the breakpoints in the wrong code, or don't know how the Editor actually does the FBX -> Stride model data transfer (is it actually in a separate process, ie. can't breakpoint?). |
This has been a frustrating part of debugging this. I have breakpoints at the following places: The breakpoints are hit or miss when I use hot reloading, only fully cleaning and rebuilding the project seems to consistently work for me. And then I have a base project that I constantly reimport the file into to try and trigger these. Thank you btw, I was likely too focused on that one issue with the metadata. If its the same then Ill do some more looking around. |
Not sure What I think is suspicious is |
I'm not on my main machine, so just throwing this out there as points of interest, will look later but if anyone else wants to investigate feel free. stride/sources/tools/Stride.Importer.3D/MeshConverter.cs Lines 580 to 589 in 0e08dfd
This gets called like This line
used to be auto transform = Matrix::Invert(rootTransform) * aiMatrixToMatrix(fromNode->mTransformation) * rootTransform;
Probably paired with this stride/sources/tools/Stride.Importer.3D/MeshConverter.cs Lines 662 to 663 in 0e08dfd
The commented out code is how the original worked, ie. boneDef.LinkToMeshMatrix = rootTransformInverse * aiMatrixToMatrix(bone->mOffsetMatrix) * rootTransform;
|
Yep, I was actually testing that while you were writing this, just commenting out the |
Fix incorrect axis on import
@Eideren I tried the cherry picked commits, and the imported models look correct. |
@Basewq works fine on my end: |
Ha, I'm silly. I somehow forgot to set the Skeleton on the Model itself. The animation is indeed working. I think the only last thing that needs is confirmation of the stride/sources/tools/Stride.Importer.3D/MeshConverter.cs Lines 378 to 390 in 0e08dfd
Was there ever a problem with the original code, or was this a case of 'didn't see an affect with the code on or off'? |
Checked with previous and current
Now if we comment out
Differences do start showing up, but there's a bunch of other issues that are introduced as well. @Jklawreszuk do you remember where this comes from ? stride/sources/tools/Stride.Importer.3D/MeshConverter.cs Lines 378 to 390 in 0e08dfd
@Doprez opened a PR, let me know if that's easier for you than cherrypicking Doprez#16 |
Pr works great for me, should be merged now. I should have some time either tomorrow or Friday to test out the changes, just been busy with work the last couple of days. |
For some reason I cant seem to get my models to do what you guys have. I still have the same result as the original description even with a
You could try the below methods to see if the bounding box is the same as before the AssImp update. I also saw this even with the samll model but I thought it may just be the model being weird and might not be related to the new importer changes. |
@Doprez Whenever you use a nuget package (ie. your game Stride projects with The purple box issue might not be related to the importer change - if you've still got the version with the old importer, can you check if the purple box is also wrong there? If so then we should make a separate issue. |
Ill try fully deleting the nugets where they get exported, everything should be correct otherwise.
The problem with the old importer is that it didnt have the model bounding box feature at the time. This was added after the new importer was merged. #2294 I will have time tonight to do some testing, what Ill do is just run the new and old version and get the mesh bounding boxes through code. If the bounding boxes are the same this may be a separate issue. |
I still cant get this model fix to work for me. Am I on the right commit? 02af13e Edit: Im an idiot, nevermind... |
Even though I cant get the fix to work I did use the below script to check the bounding box of the model while running. public class Test : SyncScript
{
public ModelComponent ModelComponent { get; set; }
public override void Start()
{
ModelComponent = Entity.Get<ModelComponent>();
}
public override void Update()
{
var test = ModelComponent.Model.BoundingBox;
}
} And placing a breakpoint after the test var gives me the below result: I dont think those values match up with the image of the bounding box @Basewq so there may be one more thing to look into. |
ayyyy ok, it seems fine at runtime so this looks like an error just in gamestudio. Tested with the same script on version 4.2.0.1: I think we can either mark this issue as a seperate issue or look into it a bit further but it does look good to me so far. let me know if you have any concerns with this @Basewq I can do some more testing today. @Eideren Ill run some of the previous tests with this branch to make sure none if the previous issues have reappeared and we may be good to go if nothing comes up. |
# Conflicts: # sources/tools/Stride.Importer.3D/MeshConverter.cs
@Doprez I think the model bounding box issue can be treated separate, especially since I didn't realize it was actually a new feature. I noticed in MeshConverter.cs you restored line 622 to use rootInverse * xx * root, however you didn't restore it for line 576 (as mentioned in #2291 (comment)). |
I couldnt find where the line used to be |
Sorry, major mistake on my part, I had been comparing it with EDIT: I'm noticing the new MeshConverter seems to be a mix between the two files, which is why I got confused. |
@Basewq anything else we should look into before merging ? |
Not from me. I think if any new issues come up, it'll be from someone who has a problematic fbx. |
Thanks ! |
PR Details
I found a new issue in the 3d Importer PR where the models seems to be rotated incorrectly. I have attempted to port over a fix from the main AssImp repo that should fix the scaling and rotation issues I had.
Current issue in master:
the old importer:
Broken FBX example
Working FBX example
Types of changes
Checklist