-
Notifications
You must be signed in to change notification settings - Fork 9
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
Maya: JSON layout for Unreal using local transform matrix instead of world matrix #12
Conversation
Don't have access to unreal setup on my end and it's hard to tell whether this is the correct fix. It is somewhat odd to me that just above we are storing translate, rotate, scale into the JSON file but store the matrix in an altered way. Anyway, the code change itself seems fine. Whether it resolves an issue, I'm not sure. |
it also looks odd to me too ngl. But what I have been seen in the unreal settings seems to be that the layout setting doesn't align with the presets set in the unreal maya preset, so that's why some transformations mess up. It would be great to know whether this extract layout has been used anywhere other than Unreal or it has been used in other extensions as I do change something to be suitable for just loading abc in unreal @antirotor @LiborBatek would be great if you can give more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once I have produced layout
product in maya
and loaded into UE as load JSON layout
I got my layout with applied transforms
as when set for maya Alembic to UE
but seems wrong oriented anyway... as seen on first img (my room being rotated to side instead of floor being the ground level) - note those transforms
and its values...
once reset it to zero transform
it looks much sensible aka correctly oriented in space as floor being ground level (wether its good or bad I cant tell but obviously closer to normal behaviour for sure)
and as seen the interior from FPView:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I will do another test round and remove all assets (as some can be already existing with wrong transforms??) outside of the layout which re-uses such asset. will update here asap, thx! |
@moonyuet it seems working when Another issue being that if any assets do not exists already within UE project (aka been loaded in advance) the |
We need to have the option which allows users to export layout for alembic and fbx separately.
This should be issue for the layout loader in unreal. I will make an issue for that. |
…l-using-local-transform-matrix-instead-of-world-matrix
@LiborBatek The updated PR can successfully flip y axis to z axis. The only circumstance is not working when the y rotation and z rotation both filled out with different values |
thats sounds really restrictive...as things living in 3 dimensional space, no?? I guess we have to solve it somehow...maybe someone can step in and help you out? |
Yes It would be great if @antirotor or @BigRoy or even some potential community members can join to discuss on that and needs more research or discussion on figuring out as when y axis moves and it would move the z axis and vice versa. The numbers are varied under the condition of z-axis being over 90, and y axis being less than 90. Anyways, it would be great to have some discussion on how to fix the rotation when it has Y axis and Z axis. Not sure if i gonna try on the graph discussed below but I think the best idea is to create another issue to discuss and do the decent fix. |
t = transform.translation(om.MSpace.kWorld) | ||
t = om.MVector(t.x, t.z, -t.y) | ||
s = transform.scale(om.MSpace.kObject) | ||
s = [s[0], s[2], s[1]] | ||
r = transform.rotation() | ||
transform.setTranslation(t, om.MSpace.kWorld) | ||
transform.rotateBy( | ||
om.MEulerRotation(math.radians(-90), 0, 0), om.MSpace.kWorld) | ||
transform.scaleBy([1.0, 1.0, -1.0], om.MSpace.kObject) | ||
transform.setRotation(om.MEulerRotation(r.x, r.z, r.y)) | ||
transform.setScale(s, om.MSpace.kObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it that we're trying to do - are we trying to rotate an object in world-space around the pivot point?
Isn't that just a matrix multiplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As maya by default is Y-axis up and unreal is Z-axis up, what we are trying to do is make sure transformation data which are Y-axis up converting to the data which are Z-axis up. Would be helpful if you can come up with some hints(or codes) for the matrix multiplication. We can edit the identity matrix from the basis, of which we dont need to setScale and setTranslation like this. But for the rotation is more complicated issue, it really needs some maths to be done.
@LiborBatek |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still some rotation offset on Z axis in UE as seen here
in maya the spacecraft has different orientation in ROT
Also worth noting that if I use Load Layout as JSON
it wont bring any assets into UE just uses the existing ones (aka already loaded) ...it used do it automatically before - when some uasset missing it just loaded it in into Content / Ayon
I want to stress again that we should avoid really doing very explicit rotation checks and fixing each 'individual case' as if those are the only problematic areas and we're much better of "finding" the right algorithm that fixes the rotation Maya->Unreal. We referenced an algorithm from Unreal Live Link plug-in somewhere midway through this PR; I still feel that something along those lines is the only real approach... so in essence, finding the right 'math' for the conversion instead of trying to nail it by if statements to resolve very specific edge cases which I assume will (at best) only fix those specific cases and will end up leaving plethora of cases that are still problematic. Unfortunately I don't have a "do this" solution (don't have unreal running here either). But I definitely feel we must be missing something 'obvious' since this should be a problem solved by many apps and/or importers/exporters throughout the years. If publicly available solutions do not work I keep the feeling that we may just be somehow preparing the data wrong to begin with. :D |
…l-using-local-transform-matrix-instead-of-world-matrix
we can create issues in unreal hosts to fix it. |
…l-using-local-transform-matrix-instead-of-world-matrix
@antirotor @LiborBatek can you test this PR along with the unreal PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The layout has still some invalid rotations on asset level. I have tested it with corresponding PR but that didnt solve it.
can you show me the transformation slot to see which rotation has been messed up? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…l-using-local-transform-matrix-instead-of-world-matrix
Changelog Description
When extracting layout, the json data should align with what Unreal used to load for the maya presets.
You can find the screengrab of the loaded preset for abc here:
ynput/ayon-unreal#15 (comment)
Additional Info
Please test along with this PR ynput/ayon-unreal#35
Testing Notes