-
Notifications
You must be signed in to change notification settings - Fork 202
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
Adds optionVars for controlling specular lighting options #2261
Conversation
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(); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
MaterialX has multiple options for specular environment sampling. They
will be exposed as optionVars.
string MxMayaEnvironmentMethod (none, prefiltered, fis)
int MxMayaEnvironmentSamples (any reasonable value, default 64)
string MxMayaEnvironmentAlbedoMethod (analytic, montecarlo)