Skip to content

Commit

Permalink
MAYA-105734 Fix broken lighting fragment
Browse files Browse the repository at this point in the history
The fragment used `#define` which leaked and broke other bragments.
  • Loading branch information
JGamache-autodesk committed Dec 3, 2020
1 parent 998aa6b commit 61a8750
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/mayaUsd/render/vp2ShaderFragments/usdPreviewSurfaceLighting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ limitations under the License.
// line 110 of "../../../../pxr/usdImaging/lib/usdShaders/shaders/previewSurface.glslfx"
#define PI 3.1415
#define EPSILON 0.001
float
SchlickFresnel(float EdotH)
{
Expand All @@ -97,6 +93,8 @@ SchlickFresnel(float EdotH)
float
NormalDistribution(float specularRoughness, float NdotH)
{
const float PI = 3.141592654;
const float EPSILON = 0.001;
float alpha = specularRoughness * specularRoughness;
float alpha2 = alpha * alpha;
float NdotH2 = NdotH * NdotH;
Expand Down Expand Up @@ -125,6 +123,7 @@ Geometric(
float
evaluateDirectDiffuse()
{
const float PI = 3.141592654;
return 1.0 / PI;
}
Expand All @@ -139,6 +138,7 @@ evaluateDirectSpecular(
float NdotH,
float EdotH)
{
const float EPSILON = 0.001;
float3 F = mix(specularColorF0, specularColorF90, fresnel);
float D = NormalDistribution(specularRoughness, NdotH);
float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH);
Expand Down Expand Up @@ -241,10 +241,6 @@ usdPreviewSurfaceLighting(
// line 110 of "../../../../pxr/usdImaging/lib/usdShaders/shaders/previewSurface.glslfx"
#define PI 3.1415
#define EPSILON 0.001
float
SchlickFresnel(float EdotH)
{
Expand All @@ -254,6 +250,8 @@ SchlickFresnel(float EdotH)
float
NormalDistribution(float specularRoughness, float NdotH)
{
const float PI = 3.141592654;
const float EPSILON = 0.001;
float alpha = specularRoughness * specularRoughness;
float alpha2 = alpha * alpha;
float NdotH2 = NdotH * NdotH;
Expand Down Expand Up @@ -282,6 +280,7 @@ Geometric(
float
evaluateDirectDiffuse()
{
const float PI = 3.141592654;
return 1.0 / PI;
}
Expand All @@ -296,6 +295,7 @@ evaluateDirectSpecular(
float NdotH,
float EdotH)
{
const float EPSILON = 0.001;
float3 F = mix(specularColorF0, specularColorF90, fresnel);
float D = NormalDistribution(specularRoughness, NdotH);
float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH);
Expand Down Expand Up @@ -398,10 +398,6 @@ usdPreviewSurfaceLighting(
// line 110 of "../../../../pxr/usdImaging/lib/usdShaders/shaders/previewSurface.glslfx"
#define PI 3.1415
#define EPSILON 0.001
float
SchlickFresnel(float EdotH)
{
Expand All @@ -411,6 +407,8 @@ SchlickFresnel(float EdotH)
float
NormalDistribution(float specularRoughness, float NdotH)
{
const float PI = 3.141592654;
const float EPSILON = 0.001;
float alpha = specularRoughness * specularRoughness;
float alpha2 = alpha * alpha;
float NdotH2 = NdotH * NdotH;
Expand Down Expand Up @@ -439,6 +437,7 @@ Geometric(
float
evaluateDirectDiffuse()
{
const float PI = 3.141592654;
return 1.0 / PI;
}
Expand All @@ -453,6 +452,7 @@ evaluateDirectSpecular(
float NdotH,
float EdotH)
{
const float EPSILON = 0.001;
float3 F = lerp(specularColorF0, specularColorF90, fresnel);
float D = NormalDistribution(specularRoughness, NdotH);
float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH);
Expand Down Expand Up @@ -555,10 +555,6 @@ usdPreviewSurfaceLighting(
// line 110 of "../../../../pxr/usdImaging/lib/usdShaders/shaders/previewSurface.glslfx"
#define PI 3.1415
#define EPSILON 0.001
float
SchlickFresnel(float EdotH)
{
Expand All @@ -568,6 +564,8 @@ SchlickFresnel(float EdotH)
float
NormalDistribution(float specularRoughness, float NdotH)
{
const float PI = 3.141592654;
const float EPSILON = 0.001;
float alpha = specularRoughness * specularRoughness;
float alpha2 = alpha * alpha;
float NdotH2 = NdotH * NdotH;
Expand Down Expand Up @@ -596,6 +594,7 @@ Geometric(
float
evaluateDirectDiffuse()
{
const float PI = 3.141592654;
return 1.0 / PI;
}
Expand All @@ -610,6 +609,7 @@ evaluateDirectSpecular(
float NdotH,
float EdotH)
{
const float EPSILON = 0.001;
float3 F = lerp(specularColorF0, specularColorF90, fresnel);
float D = NormalDistribution(specularRoughness, NdotH);
float G = Geometric(specularRoughness, NdotL, NdotE, NdotH, EdotH);
Expand Down

0 comments on commit 61a8750

Please sign in to comment.