-
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
Merged
seando-adsk
merged 3 commits into
dev
from
t_gamaj/MAYA-121806/add_specular_lighting_optionVars
Apr 12, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
lib/mayaUsd/render/MaterialXGenOgsXml/libraries/mx_lighting_maya_none.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This is the same algorithm as found in libraries\pbrlib\genglsl\lib\mx_environment_prefilter.glsl | ||
// but adjusted for Maya. At this time we will compute a roughness based on the radiance and | ||
// irradiance samples, so materials with small amount of roughness will look wrong. | ||
// | ||
// A more precise roughness computation can be done using Maya samplers, but this requires | ||
// knowing that the Maya sampling functions are there, otherwise compilation will fail unless | ||
// there is an IBL active in the Maya lighting. | ||
|
||
#include "pbrlib/genglsl/lib/mx_microfacet_specular.glsl" | ||
|
||
vec3 mx_environment_irradiance(vec3 N) | ||
{ | ||
return vec3(0); | ||
} | ||
|
||
vec3 mx_environment_radiance(vec3 N, vec3 V, vec3 X, vec2 roughness, int distribution, FresnelData fd) | ||
{ | ||
return vec3(0); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,6 @@ | |
|
||
#include "pbrlib/genglsl/lib/mx_microfacet_specular.glsl" | ||
|
||
// TODO: Make the number of samples either an environment variable or an optionVar. | ||
// Keeping it a hard constant instead of a uniform allows loop unrolling by the compiler. | ||
#define MX_NUM_FIS_SAMPLES 64 | ||
|
||
// TODO: We could also expose another toggle between the extremely slow: | ||
// mx_ggx_dir_albedo_monte_carlo() | ||
// And the faster: | ||
// mx_ggx_dir_albedo_analytic() | ||
// But we will currently default to the faster one. | ||
|
||
// https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch20.html | ||
// Section 20.4 Equation 13 | ||
float mx_latlong_compute_lod(vec3 dir, float pdf, float maxMipLevel, int envSamples) | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Bail out early if there is no dome light. |
||
return vec3(0); | ||
} | ||
|
||
// Generate tangent frame. | ||
vec3 Y = normalize(cross(N, X)); | ||
X = cross(Y, N); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.