PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.5k stars 1.14k forks source link

Update to MaterialX v1.38.3 #1792

Closed seando-adsk closed 2 years ago

seando-adsk commented 2 years ago

Description of Change(s)

This is the last update that is not version tagged in the C++ code. Future updates will be bracketed using MATERIALX_MINOR_VERSION defines introduced in v1.38.3.

Notes:

jilliene commented 2 years ago

Filed as internal issue #USD-7254

pablode commented 2 years ago

Hi! I made some efforts to port this PR to MaterialX 1.38.4. You can find the diff here: https://github.com/autodesk-forks/USD/compare/adsk/update_to_materialx_1.38.3...pablode:mtlx-1.38.4

Commit 93aed43 contains a change which was presumably missed in the transition to 1.38.3.

spiffmon commented 2 years ago

If Autodesk's preference is to jump right to 1.38.4, that would be good to know ASAP, and we'd ask that this PR be updated with additional changes? (And others following along please advise if you think that would not be desirable)

JGamache-autodesk commented 2 years ago

Hi @spiffmon , I will update to 1.38.4 and generate a patch for @seando-adsk . The code @pablode wrote is very good, but there is a subtle bug in mx::loadLibraries when passing { "libraries" } that I prefer not triggering. I will try to complete this ASAP.

seando-adsk commented 2 years ago

@JGamache-autodesk Thanks for the patch Jerry. I have applied it and uploaded the commit to this PR. @spiffmon The update to v1.38.4 should be ready now.

spiffmon commented 2 years ago

Can either of you say whether the PR will leave the code valid also for 1.38.3, as well? That may affect the speed with which we’re able to take it, as we just got 1.38.3 installed, and it may be awhile before our infra team gets 1.38.4 in.

On Tue, Apr 19, 2022 at 11:25 AM Sean Donnelly @.***> wrote:

@JGamache-autodesk https://github.com/JGamache-autodesk Thanks for the patch Jerry. I have applied it and uploaded the commit to this PR. @spiffmon https://github.com/spiffmon The update to v1.38.4 should be ready now.

— Reply to this email directly, view it on GitHub https://github.com/PixarAnimationStudios/USD/pull/1792#issuecomment-1102954649, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPOU2C33EJL6D3CXMJNFCDVF33A7ANCNFSM5PSH26UA . You are receiving this because you were mentioned.Message ID: @.***>

-- --spiffiPhone

JGamache-autodesk commented 2 years ago

@spiffmon sorry, this was 1.38.4 only. I will generate a code patch to stay backward compatible to 1.38.3.

seando-adsk commented 2 years ago

@JGamache-autodesk / @spiffmon Support for v1.38.3 added back in (patch from Jerry).

spiffmon commented 2 years ago

Much obliged, gentlemen!

On Tue, Apr 19, 2022 at 1:25 PM Sean Donnelly @.***> wrote:

@JGamache-autodesk https://github.com/JGamache-autodesk / @spiffmon https://github.com/spiffmon Support for v1.38.3 added back in (patch from Jerry).

— Reply to this email directly, view it on GitHub https://github.com/PixarAnimationStudios/USD/pull/1792#issuecomment-1103104823, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPOU2FVRUMV3FBNK2PITGLVF4JCPANCNFSM5PSH26UA . You are receiving this because you were mentioned.Message ID: @.***>

seando-adsk commented 2 years ago

Is there a chance this can make it into 22.05?

spiffmon commented 2 years ago

Sorry, @seando-adsk , 22.05 is basically cooked and nearly out the door. We can commit to getting this into our (next) summer release, though.

sunyab commented 2 years ago

I am reviewing this change now. One question I had: is the change to use the CMake module out of the MaterialX install necessary for upgrading to 1.38.3, or was it a nice-to-have? I've noticed that this causes the build to fail when building against 1.38.3 when the Python module is not installed -- this looks like a bug that was fixed in 1.38.4.

JGamache-autodesk commented 2 years ago

Hi @sunyab, using the CMake generated by MaterialX:

These are changes that are very hard to retrofit into FindMaterialX.cmake. Also fixes the issue of all those slightly incompatible FindMaterialX.cmake found in various projects that can now all be deleted.

If you look in the original 1.38.3 commit, you will see that build_usd.py had workarounds for these issues. Feel free to bring them back if you want to allow using build_usd.py with that MaterialX version.

marktucker commented 2 years ago

I recently used this PR to build 22.05 against Mtls 1.38.4. I just wanted to point out that pxr/usdImaging/bin/usdBakeMtlx also needs modifications similar to other included in this PR to be able to build.

I also had to add back the MATERIALX_INCLUDE_DIR to get any of the Mtlx-consuming libraries to build. I'm not sure where in this PR the Mtlx include dir is supposed to be added to the compiler command line. And I had to leave the old FindMaterialX.cmake file in place, and revert to using MATERIALX_LIBRARIES to get linking to work. But I'm on Windows, and building USD in a very unique environment, not using build_usd.py. Basically I didn't end up using most (any?) of the CMakeLists changes. So these problems/comments may not be valid for anyone else.

seando-adsk commented 2 years ago

@marktucker You mention that this PR will require changes to pxr/usdImaging/bin/usdBakeMtlx to build. There are already changes in that folder. I have built 22.05 locally on Windows with these changes from this PR without any problems. We are using the build_usd.py script.

Sean

marktucker commented 2 years ago

My apologies, you are correct. I must have done something wrong when I brought your changes into my baseline. Please ignore that part of my comment. And as I said my build environment is... unique... so obviously feel free to ignore my comments about the CMake process. Which I guess means you can ignore everything I said. Sorry for the noise.

JGamache-autodesk commented 2 years ago

Hi @sunyab. Sorry for missing that MATERIALX_FOUND. Modern CMake stopped capitalizing library names, so I should have replaced it with MaterialX_FOUND. As for the image differences.

seando-adsk commented 2 years ago

@sunyab I added another patch from Jerry to Enable FIS lighting for MaterialX 1.38.3 and later. I had to merge in latest dev first.

sunyab commented 2 years ago

@JGamache-autodesk Thank you for the comments on those test cases, that was super helpful!

@seando-adsk Could I ask you to revert that FIS patch and file another PR for that so we can evaluate that separately?

Otherwise I think we're all set to land this PR once that last commit is reverted.

seando-adsk commented 2 years ago

@sunyab Sure I can revert the last commit. Question though, do you want the MaterialX_FOUND cmake change in this PR or with the new PR?

sunyab commented 2 years ago

@seando-adsk Ah please leave the MaterialX_FOUND change in this PR since it keeps tests running. Thanks!

seando-adsk commented 2 years ago

@sunyab Done, I've corrected the last commit to be just the cmake change.