Closed vernalchen closed 2 years ago
@vernalchen You make a good case for this proposed change, and it sounds quite reasonable to me.
I'm CC'ing @bernardkwok for his thoughts, since the current implementation of place2d
goes back to its origins in ShaderX (the predecessor of MaterialX ShaderGen that Autodesk contributed to the project in 2019).
@vernalchen Let's update the attached sample to use stdlib place2d
and image
node.
@jstone-lucasfilm From MaterialX specification point of view, is there any requirement for place2d
to match Usd Transform2d
@ashwinbhat Thanks! The sample mtlx has been updated.
I've checked this and this was taken from Maya but it is a consistent order of operations which matches UsdTransform2d
based on the documentation you mentioned Ashwin, and also MDL (see the transform_rotation_scale_translation
intrinsic description). So a skew / shear can occur.
If something else is desired I guess a different variant could be added. e.g. MDL supports transform_XYZ, but I don't see this in USD.
( Khronos has a different issue related to being top-down orientation vs bottom-up which is the MaterialX convention and uses negative numbers to flip, which is not quite matching. )
Perhaps as a shorter term workaround, as this is inside a Autodesk specific nodedef, you could create what you want there to match Inventor / RapidRT etc ?
One final note. I am guessing that what you want to a "frame" (of reference) transform (Coverage, Translate / Rotate Frame
). Both are allowed in Maya in the same node.
They naturally have different behaviours. The current definition is not a "frame" transform is where I'm guessing is the mismatch.
@kwokcb we would like to propose a variant of place2d
that changes the order of the operations. Would the preference be a bool input or a new place2d
node.
That's OK for us if "not frame" transformation is another expected behavior. Sounds good to have a variant that works for us. After getting the answer to the preference, @vernalchen could submit a PR for this issue.
If the preference is a new placd2d node, shall we put it in stdlib or inside autodesk lib?
As @kwokcb mentioned, Maya supports both, it seems better to have another standard place2d node in stdlib to support "frame" translation. It looks we could propose the new node with name "place2dframe" in stdlib.
@kwokcb I tried to fix this issue with a new place2dframe
node without modifying the original place2d
node.
If a bool input is prefered I could also change to that way.
https://github.com/AcademySoftwareFoundation/MaterialX/pull/1027
Hi folks,
My feeling is you don't want to create "super nodes" with booleans to switch behaviour so a place2dframe
makes more sense to me. Thanks for putting up the new definition.
Thanks for this original report, @vernalchen, as well as the fix in pull request #1027.
The place2d node transforms the uv coordinates in the order of -pivot, scale, rotate, translate, pivot. This will result in skew results when the rotation is not zero, while scale x and scale y has different values, which is unacceptable. Instead, the sequence of transformation should be (in the order of application): -pivot, translate, rotate, scale, pivot.
sample mtlx: