Skip to content
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

Backport of OpenPBR Surface (GLSL) to 1.38.10 #1408

Closed

Conversation

JGamache-autodesk
Copy link
Collaborator

No description provided.

@JGamache-autodesk JGamache-autodesk marked this pull request as draft October 17, 2024 15:17
OpenPBR Surface node definition backported to MaterialX 1.38.10
Snapshot taken at commit f98abc43 from June 16th 2024.
-->
<nodedef name="ND_open_pbr_surface_surfaceshader" node="open_pbr_surface" nodegroup="OpenPBR" version="1.1" isdefaultversion="true"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses the official OpenPBR Surface node ID because this is the real deal, so no upgrade path necessary for this one.

@@ -0,0 +1,30 @@
#include "mx_microfacet.glsl"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always include the 1.38 code for all functions that were unchanged in 1.39.

Modus operandi:
Copy all files that are used by OpenPBR surface and have changes in 1.39. Prefix them with mx39_

Then, for each file:
Do a diff between 1.38 and 1.39. If a function, struct, or macro was modified in 1.39 prefix them with mx39_, Mx39, and MX39_ (in that order). Find all call sites of the modified function in the mx39_ files, and update them. Remove any function, struct, or macro that was not changed since we will get it via the original files. This helps keep the backport small and reduces code duplication.

Extra step is to further prune code that is unused by OpenPBR Surface.

@@ -67,3 +67,5 @@ vec3 mx_environment_irradiance(vec3 N)
vec3 Li = mx_latlong_map_lookup(N, $envMatrix, 0.0, $envIrradiance);
return Li * $envLightIntensity;
}

#define MX39_USING_ENVIRONMENT_FIS
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those defines are the only modifications on 1.38 library code. Allows updated versions to be enabled as required since the FresnelData struct is different for mx39_ code.

@@ -417,4 +417,75 @@
<output name="extinction" type="color3" />
</nodedef>

<!-- ======================================================================== -->
<!-- OpenPBR Surface Nodes backported from 1.39 -->
<!-- ======================================================================== -->
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need these 4 new nodes in PBR lib. Would be of interest to provide an upgrade path in case they get re-used somewhere else in client code. Upgrade path is to use the refreshed 1.39 node with proper input values for the requested mode.

@kikou
Copy link

kikou commented Oct 23, 2024

This PR is continued in the legacy_1.38 branch of MaterialX: AcademySoftwareFoundation#2082

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.

2 participants