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

Adds optionVars for controlling specular lighting options #2261

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

JGamache-autodesk
Copy link
Collaborator

MaterialX has multiple options for specular environment sampling. They
will be exposed as optionVars.

string MxMayaEnvironmentMethod (none, prefiltered, fis)

  • Defaults to fis in V3, prefiltered otherwise

int MxMayaEnvironmentSamples (any reasonable value, default 64)

  • only valid in FIS mode

string MxMayaEnvironmentAlbedoMethod (analytic, montecarlo)

  • only valid in FIS mode

MaterialX has multiple options for specular environment sampling. They
will be exposed as optionVars.

string MxMayaEnvironmentMethod (none, prefiltered, fis)
  - Defaults to fis in V3, prefiltered otherwise

int MxMayaEnvironmentSamples (any reasonable value, default 64)
  - only valid in FIS mode

string MxMayaEnvironmentAlbedoMethod (analytic, montecarlo)
  - only valid in FIS mode
@@ -223,7 +294,8 @@ std::string generateFragment(
// MaterialX fragment).
std::ostringstream nameStream;
const size_t sourceHash = std::hash<std::string> {}(fragmentSource);
nameStream << baseFragmentName << "__" << std::hex << sourceHash;
nameStream << baseFragmentName << "__" << std::hex << sourceHash
<< OgsFragment::getSpecularEnvKey();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shader code depends on environment settings, so we must make sure we add the key everywhere we want to cache shaders.

@@ -28,6 +18,10 @@ float mx_latlong_compute_lod(vec3 dir, float pdf, float maxMipLevel, int envSamp

vec3 mx_environment_radiance(vec3 N, vec3 V, vec3 X, vec2 roughness, int distribution, FresnelData fd)
{
if (mayaGetSpecularEnvironmentNumLOD() == 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bail out early if there is no dome light.

@@ -279,6 +279,8 @@ struct _MaterialXData
mx::loadLibraries({}, _mtlxSearchPath, _mtlxLibrary);

_FixLibraryTangentInputs(_mtlxLibrary);

mx::OgsXmlGenerator::setUseLightAPI(MAYA_LIGHTAPI_VERSION_2);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved from below. Only needs to be called once.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Apr 12, 2022
@seando-adsk seando-adsk merged commit 4bf853e into dev Apr 12, 2022
@seando-adsk seando-adsk deleted the t_gamaj/MAYA-121806/add_specular_lighting_optionVars branch April 12, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants