Comments (8)
[deleted comment]
from assimp-net.
There seems to be a discrepancy in Decompose from Assimp's source - I need to
dive deeper into this. It looks like a confusion of row-vs-column vector
ordering.
Have you tried the static decompose method exposed in AssimpMethods (in
Assimp.Unmanaged namespace)? Does it give the same result?
Also, do you mind supplying some test input?
Original comment by nicholas.woodfield
on 2 Nov 2012 at 12:47
from assimp-net.
I also had this problem, the decompose() function of Assimp.Net gave me very
strange results. By copying the Assimp.Net matrix into a Mogre matrix (I use
the Mogre library for rendering) and decomposing it using Mogre I finally got
the expected result.
Original comment by [email protected]
on 2 Nov 2012 at 1:56
from assimp-net.
ok.. i have been looking into this more.. this is what i got :
1) I tried Assimp.Unmanaged.AssimpMethods.DecomposeMatrix and it does not work.
2) a simple way you could try to reproduce this is by decomposing and
re-composing the offset matrix and see if it work. for example :
Vector3D scale, pos;
Quaternion quat;
var m = aibone.OffsetMatrix;
m.Decompose(out scale, out quat, out pos);
var new_m = Matrix4x4.FromScaling(scale) * new Matrix4x4(quat.GetMatrix()) *
Matrix4x4.FromTranslation(pos);
When you try to use new_m instead of m the result are wrong.
3) I also attach the mesh that i use for testing ( good old bob ).
4) I did a test where i take the matrix and decompose it with both Assimp and
SharpDX to examine the differences in the results. They both seem to agree in
the scale and translation , but they differ in the rotation quaternion !!
Original comment by [email protected]
on 2 Nov 2012 at 9:38
Attachments:
from assimp-net.
Thanks,
Alright, I think I got to the bottom of this. There were several
inconsistencies with converting between quaternions/matrices which seemed to be
causing the issue in Decompose.
I also added some extra documentation for assumptions on matrix order. Note
that Assimp (and by extension, AssimpNet) use row-major, column-vector
matrices. APIs such as SharpDX/XNA/SlimDX (and apparently OpenTK) use
row-major, row-vector matrices, so make sure when you convert from an Assimp
Matrix you first transpose it. Personally, I prefer row vector matrices and
tend to use them more often. I would recommend always using the Math library of
your graphics API though, the AssimpNet math structures really are only the
bare minimum.
Also worth to note, that SRT order for column vector matrices would be TRS, but
the matrix multiplication method for Matrix3x3 and Matrix4x4 are BxA rather
than AxB. As I said, I added documentation to highlight this (for myself,
especially).
The changes are in r50, I'll keep the ticket open a while longer if there are
still issues (math inconsistencies are always a pain!).
Original comment by nicholas.woodfield
on 4 Nov 2012 at 7:13
- Changed state: Started
from assimp-net.
That's good .. and i agree that you should always copy the matrix to your
graphics API and use it there , something you are bound to do anyway down the
road.
What bothers me though is this:
1) i was using assimp's decompose before (v2.x) and it worked fine (and with
SharpDX). So unless they changed the matrix ordering from one version to the
next (unlikely) something else must be wrong.
2) The results of the Decomposing are matrix-order-indepented . That means that
if i use assimp.net decompose function on an assimp.net matrix , the scale
quaternion and translation i get back should be the same as if i decompose a
matrix in sharpdx/slimdx/...
I am not really using the decompose function anymore , but i still think
someone might.
Thanks :)
Original comment by [email protected]
on 4 Nov 2012 at 10:13
from assimp-net.
Oh, my apologies. I thought the commit you made was for documentation only, i
didn't realized you had fixes.
I just checked out the r50 and gave it a try. it seems to behave correct now :)
Original comment by [email protected]
on 4 Nov 2012 at 10:39
from assimp-net.
Excellent, closing the ticket
Original comment by nicholas.woodfield
on 4 Nov 2012 at 5:50
- Changed state: Fixed
from assimp-net.
Related Issues (20)
- Help with scene creation HOT 1
- Custom IO System doesnt work when Importing from stream HOT 2
- blender 2.7.9 .obj file has blank names. (using 3.3.1 Release) HOT 1
- Problem importing OBJ files (probably assimp problem, not assimpNet)
- Is there a EmbededTexture property from which I can get the texture image reference ? HOT 2
- Sample uses GL.Begin/GL.End
- exceptions when reading ifc files.
- Observed incorrect DurationInTicks when loading .GLB models.
- New version needed HOT 3
- IMPORT_COLLADA_USE_COLLADA_NAMES
- Error when importing assembly stream
- I get an error when I try to build
- I got problem with serialization
- Indices not in a multiple of three
- Exploded ifc in example project
- AssimpContext.ExportFile broken HOT 3
- Issue with glb2 export
- Wierd/Wrong import of COLLADA (.dae ) files
- ApplyPostProcessing after Scene.ToUnmanagedScene() returns IntPtr.Zero
- How can I get texture data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assimp-net.