Skip to content

Conversation

@jstone-lucasfilm
Copy link
Member

This changelist updates the transform(matrix, vector4) method in genosl to match a corresponding fix in the OSL codebase. See AcademySoftwareFoundation/OpenShadingLanguage#1513 for more details.

This changelist updates the transform(matrix, vector4) method in genosl to match a corresponding fix in the OSL codebase.  See AcademySoftwareFoundation/OpenShadingLanguage#1513 for more details.
@kwokcb
Copy link
Contributor

kwokcb commented May 30, 2022

Hi @rasmusbonnedal,
I replied in Slack, but yes, I believe these will break. Running the test suite for OSL rendering before and after should see what's changed (in case there is more). Also I'd suggest we change these to be vec3 computations as AFAIK no input colorspace transform modifies the 4th channel (alpha) (at least not in the OCIO implementations).

@rasmusbonnedal
Copy link
Contributor

@kwokcb I agree! I searched for transform in all *.{osl,h} in the repo and these were all which uses vector4.

@jstone-lucasfilm
Copy link
Member Author

Good points, @rasmusbonnedal and @kwokcb, and let's double check these visual behaviors before merging the fix. In some cases, we may have been transposing the matrix to compensate for this issue, and in those situations we should remove the unneeded transpose calls.

@jstone-lucasfilm
Copy link
Member Author

Attaching reference renders with the latest proposed changes:

MaterialX_ReferenceRenders_05_30_2022.pdf

@jstone-lucasfilm jstone-lucasfilm merged commit 0dafbd9 into AcademySoftwareFoundation:main May 31, 2022
@rasmusbonnedal
Copy link
Contributor

I think rotate3d needs to add a transpose: https://github.com/jstone-lucasfilm/MaterialX/blob/e47a3b3f14860d1b7e19fa49fa899fed973a73ea/libraries/stdlib/genosl/mx_rotate_vector3.osl#L18

This is before the change in transpose(matrix, vector4):
rotate3d_before_change

This is after:
rotate3d_after_change

@jstone-lucasfilm
Copy link
Member Author

@rasmusbonnedal I was curious about this as well, and I couldn't find an existing test material that would confirm this one way or another. If you're confident that the original version was correct, and a transpose is now needed for parity, would you have the bandwidth to write up a pull request for this change to the MaterialX GitHub?

@rasmusbonnedal
Copy link
Contributor

I compared the results with GLSL and it corresponds to the "after" result. It seems rotate3d was different before between OSL and GLSL and are the same now. So all good!

image

@jstone-lucasfilm
Copy link
Member Author

That's great news, @rasmusbonnedal, and thanks for confirming!

Michaelredaa pushed a commit to Michaelredaa/MaterialX that referenced this pull request Oct 21, 2023
This changelist updates the transform(matrix, vector4) method in genosl to match a corresponding fix in the OSL codebase.  See AcademySoftwareFoundation/OpenShadingLanguage#1513 for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants