Skip to content

Commit 64f52a3

Browse files
Merge pull request #82 from EvgeniiG/master
Improve consistency
2 parents 673405e + 0a142c8 commit 64f52a3

12 files changed

Lines changed: 210 additions & 192 deletions

File tree

Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.hlsl

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ BSDFData ConvertSurfaceDataToBSDFData(SurfaceData surfaceData)
112112
bsdfData.diffuseColor = surfaceData.baseColor * (1.0 - surfaceData.metallic);
113113
bsdfData.fresnel0 = lerp(float3(surfaceData.specular, surfaceData.specular, surfaceData.specular), surfaceData.baseColor, surfaceData.metallic);
114114

115-
bsdfData.tangentWS = surfaceData.tangentWS;
116-
bsdfData.bitangentWS = cross(surfaceData.normalWS, surfaceData.tangentWS);
115+
bsdfData.tangentWS = surfaceData.tangentWS;
116+
bsdfData.bitangentWS = cross(surfaceData.normalWS, surfaceData.tangentWS);
117117
ConvertAnisotropyToRoughness(bsdfData.roughness, surfaceData.anisotropy, bsdfData.roughnessT, bsdfData.roughnessB);
118118
bsdfData.anisotropy = surfaceData.anisotropy;
119119

@@ -284,7 +284,6 @@ void DecodeFromGBuffer(
284284
bsdfData.fresnel0 = lerp(float3(specular, specular, specular), baseColor, metallic);
285285

286286
bsdfData.tangentWS = UnpackNormalOctEncode(float2(inGBuffer2.rg * 2.0 - 1.0));
287-
// TODO: Do we need to orthonormalize here, IIRC Eric say that we should
288287
bsdfData.bitangentWS = cross(bsdfData.normalWS, bsdfData.tangentWS);
289288
ConvertAnisotropyToRoughness(bsdfData.roughness, anisotropy, bsdfData.roughnessT, bsdfData.roughnessB);
290289
bsdfData.anisotropy = anisotropy;
@@ -470,8 +469,8 @@ PreLightData GetPreLightData(float3 V, PositionInputs posInput, BSDFData bsdfDat
470469
{
471470
PreLightData preLightData;
472471

473-
// TODO: check Eric idea about doing that when writting into the GBuffer (with our forward decal)
474-
preLightData.NdotV = GetShiftedNdotV(bsdfData.normalWS, V, false);
472+
// We do not saturate to correctly handle double-sided lighting.
473+
preLightData.NdotV = dot(bsdfData.normalWS, V);
475474

476475
preLightData.ggxLambdaV = GetSmithJointGGXLambdaV(preLightData.NdotV, bsdfData.roughness);
477476

@@ -490,7 +489,6 @@ PreLightData GetPreLightData(float3 V, PositionInputs posInput, BSDFData bsdfDat
490489
// NOTE: If we follow the theory we should use the modified normal for the different calculation implying a normal (like NDotV) and use iblNormalWS
491490
// into function like GetSpecularDominantDir(). However modified normal is just a hack. The goal is just to stretch a cubemap, no accuracy here.
492491
// With this in mind and for performance reasons we chose to only use modified normal to calculate R.
493-
// iblNdotV = GetShiftedNdotV(iblNormalWS, V), false);
494492
}
495493

496494
GetPreIntegratedFGD(iblNdotV, bsdfData.perceptualRoughness, bsdfData.fresnel0, preLightData.specularFGD, preLightData.diffuseFGD);
@@ -501,7 +499,7 @@ PreLightData GetPreLightData(float3 V, PositionInputs posInput, BSDFData bsdfDat
501499

502500
// Area light specific
503501
// UVs for sampling the LUTs
504-
float theta = FastACos(dot(bsdfData.normalWS, V));
502+
float theta = FastACos(preLightData.NdotV);
505503
// Scale and bias for the current precomputed table - the constant use here are the one that have been use when the table in LtcData.DisneyDiffuse.cs and LtcData.GGX.cs was use
506504
float2 uv = 0.0078125 + 0.984375 * float2(bsdfData.perceptualRoughness, theta * INV_HALF_PI);
507505

@@ -589,6 +587,9 @@ void BSDF( float3 V, float3 L, float3 positionWS, PreLightData preLightData, BS
589587
float BdotH = dot(bsdfData.bitangentWS, H);
590588
float BdotL = dot(bsdfData.bitangentWS, L);
591589

590+
bsdfData.roughnessT = ClampRoughnessForAnalyticalLights(bsdfData.roughnessT);
591+
bsdfData.roughnessB = ClampRoughnessForAnalyticalLights(bsdfData.roughnessB);
592+
592593
#ifdef LIT_USE_BSDF_PRE_LAMBDAV
593594
Vis = V_SmithJointGGXAnisoLambdaV( preLightData.TdotV, preLightData.BdotV, preLightData.NdotV, TdotL, BdotL, NdotL,
594595
bsdfData.roughnessT, bsdfData.roughnessB, preLightData.anisoGGXLambdaV);
@@ -602,6 +603,8 @@ void BSDF( float3 V, float3 L, float3 positionWS, PreLightData preLightData, BS
602603
}
603604
else
604605
{
606+
bsdfData.roughness = ClampRoughnessForAnalyticalLights(bsdfData.roughness);
607+
605608
#ifdef LIT_USE_BSDF_PRE_LAMBDAV
606609
Vis = V_SmithJointGGX(NdotL, preLightData.NdotV, bsdfData.roughness, preLightData.ggxLambdaV);
607610
#else
@@ -863,9 +866,8 @@ void EvaluateBSDF_Line(LightLoopContext lightLoopContext,
863866
P1 -= positionWS;
864867
P2 -= positionWS;
865868

866-
// Construct an orthonormal basis (local coordinate system) around N.
867-
// TODO: it could be stored in PreLightData. All LTC lights compute it more than once!
868-
// Also consider using 'bsdfData.tangentWS', 'bsdfData.bitangentWS', 'bsdfData.normalWS'.
869+
// Construct a view-dependent orthonormal basis around N.
870+
// TODO: it could be stored in PreLightData, since all LTC lights compute it more than once.
869871
float3x3 basis;
870872
basis[0] = normalize(V - bsdfData.normalWS * preLightData.NdotV);
871873
basis[1] = normalize(cross(bsdfData.normalWS, basis[0]));
@@ -1100,17 +1102,15 @@ void EvaluateBSDF_Area(LightLoopContext lightLoopContext,
11001102
// ----------------------------------------------------------------------------
11011103

11021104
// Ref: Moving Frostbite to PBR (Appendix A)
1103-
float3 IntegrateLambertIBLRef( LightLoopContext lightLoopContext,
1104-
EnvLightData lightData, BSDFData bsdfData,
1105-
uint sampleCount = 2048)
1105+
float3 IntegrateLambertIBLRef(LightLoopContext lightLoopContext,
1106+
float3 V, EnvLightData lightData, BSDFData bsdfData,
1107+
uint sampleCount = 4096)
11061108
{
1107-
float3 N = bsdfData.normalWS;
1108-
float3 tangentX = bsdfData.tangentWS;
1109-
float3x3 localToWorld = GetLocalFrame(N, tangentX);
1109+
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS);
11101110
float3 acc = float3(0.0, 0.0, 0.0);
11111111

11121112
// Add some jittering on Hammersley2d
1113-
float2 randNum = InitRandom(N.xy * 0.5 + 0.5);
1113+
float2 randNum = InitRandom(V.xy * 0.5 + 0.5);
11141114

11151115
for (uint i = 0; i < sampleCount; ++i)
11161116
{
@@ -1135,17 +1135,14 @@ float3 IntegrateLambertIBLRef( LightLoopContext lightLoopContext,
11351135
}
11361136

11371137
float3 IntegrateDisneyDiffuseIBLRef(LightLoopContext lightLoopContext,
1138-
float3 V, EnvLightData lightData, BSDFData bsdfData,
1139-
uint sampleCount = 2048)
1138+
float3 V, PreLightData preLightData, EnvLightData lightData, BSDFData bsdfData,
1139+
uint sampleCount = 4096)
11401140
{
1141-
float3 N = bsdfData.normalWS;
1142-
float3 tangentX = bsdfData.tangentWS;
1143-
float3x3 localToWorld = GetLocalFrame(N, tangentX);
1144-
float NdotV = GetShiftedNdotV(N, V, false);
1141+
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS);
11451142
float3 acc = float3(0.0, 0.0, 0.0);
11461143

11471144
// Add some jittering on Hammersley2d
1148-
float2 randNum = InitRandom(N.xy * 0.5 + 0.5);
1145+
float2 randNum = InitRandom(V.xy * 0.5 + 0.5);
11491146

11501147
for (uint i = 0; i < sampleCount; ++i)
11511148
{
@@ -1164,7 +1161,7 @@ float3 IntegrateDisneyDiffuseIBLRef(LightLoopContext lightLoopContext,
11641161
float LdotH = dot(L, H);
11651162
// Note: we call DisneyDiffuse that require to multiply by Albedo / PI. Divide by PI is already taken into account
11661163
// in weightOverPdf of ImportanceSampleLambert call.
1167-
float disneyDiffuse = DisneyDiffuse(NdotV, NdotL, LdotH, bsdfData.perceptualRoughness);
1164+
float disneyDiffuse = DisneyDiffuse(preLightData.NdotV, NdotL, LdotH, bsdfData.perceptualRoughness);
11681165

11691166
// diffuse Albedo is apply here as describe in ImportanceSampleLambert function
11701167
float4 val = SampleEnv(lightLoopContext, lightData.envIndex, L, 0);
@@ -1176,18 +1173,13 @@ float3 IntegrateDisneyDiffuseIBLRef(LightLoopContext lightLoopContext,
11761173
}
11771174

11781175
// Ref: Moving Frostbite to PBR (Appendix A)
1179-
float3 IntegrateSpecularGGXIBLRef( LightLoopContext lightLoopContext,
1180-
float3 V, EnvLightData lightData, BSDFData bsdfData,
1181-
uint sampleCount = 2048)
1176+
float3 IntegrateSpecularGGXIBLRef(LightLoopContext lightLoopContext,
1177+
float3 V, PreLightData preLightData, EnvLightData lightData, BSDFData bsdfData,
1178+
uint sampleCount = 4096)
11821179
{
1183-
float3 N = bsdfData.normalWS;
1184-
float3 tangentX = bsdfData.tangentWS;
1185-
float3 tangentY = bsdfData.bitangentWS;
1186-
float3x3 localToWorld = GetLocalFrame(N, tangentX);
1187-
float NdotV = GetShiftedNdotV(N, V, false);
1180+
float3x3 localToWorld = float3x3(bsdfData.tangentWS, bsdfData.bitangentWS, bsdfData.normalWS);
11881181
float3 acc = float3(0.0, 0.0, 0.0);
11891182

1190-
11911183
// Add some jittering on Hammersley2d
11921184
float2 randNum = InitRandom(V.xy * 0.5 + 0.5);
11931185

@@ -1204,11 +1196,11 @@ float3 IntegrateSpecularGGXIBLRef( LightLoopContext lightLoopContext,
12041196
// GGX BRDF
12051197
if (bsdfData.materialId == MATERIALID_LIT_ANISO)
12061198
{
1207-
ImportanceSampleAnisoGGX(u, V, N, tangentX, tangentY, bsdfData.roughnessT, bsdfData.roughnessB, NdotV, L, VdotH, NdotL, weightOverPdf);
1199+
ImportanceSampleAnisoGGX(u, V, localToWorld, bsdfData.roughnessT, bsdfData.roughnessB, preLightData.NdotV, L, VdotH, NdotL, weightOverPdf);
12081200
}
12091201
else
12101202
{
1211-
ImportanceSampleGGX(u, V, localToWorld, bsdfData.roughness, NdotV, L, VdotH, NdotL, weightOverPdf);
1203+
ImportanceSampleGGX(u, V, localToWorld, bsdfData.roughness, preLightData.NdotV, L, VdotH, NdotL, weightOverPdf);
12121204
}
12131205

12141206

@@ -1239,13 +1231,13 @@ void EvaluateBSDF_Env( LightLoopContext lightLoopContext,
12391231

12401232
#ifdef LIT_DISPLAY_REFERENCE_IBL
12411233

1242-
specularLighting = IntegrateSpecularGGXIBLRef(lightLoopContext, V, lightData, bsdfData);
1234+
specularLighting = IntegrateSpecularGGXIBLRef(lightLoopContext, V, preLightData, lightData, bsdfData);
12431235

12441236
/*
12451237
#ifdef LIT_DIFFUSE_LAMBERT_BRDF
1246-
diffuseLighting = IntegrateLambertIBLRef(lightData, bsdfData);
1238+
diffuseLighting = IntegrateLambertIBLRef(lightData, V, bsdfData);
12471239
#else
1248-
diffuseLighting = IntegrateDisneyDiffuseIBLRef(lightLoopContext, V, lightData, bsdfData);
1240+
diffuseLighting = IntegrateDisneyDiffuseIBLRef(lightLoopContext, V, preLightData, lightData, bsdfData);
12491241
#endif
12501242
*/
12511243
diffuseLighting = float3(0.0, 0.0, 0.0);
@@ -1334,9 +1326,7 @@ void EvaluateBSDF_Env( LightLoopContext lightLoopContext,
13341326
specularLighting *= bsdfData.specularOcclusion;
13351327
diffuseLighting = float3(0.0, 0.0, 0.0);
13361328

1337-
#endif
1329+
#endif
13381330
}
13391331

13401332
#endif // #ifdef HAS_LIGHTLOOP
1341-
1342-

Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs p
215215
float3 normalTS;
216216
float alpha = GetSurfaceData(input, layerTexCoord, surfaceData, normalTS);
217217
surfaceData.normalWS = TransformTangentToWorld(normalTS, input.tangentToWorld);
218+
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
219+
220+
bool twoSided = false;
221+
// This will always produce the correct 'NdotV' value, but potentially
222+
// reduce the length of the normal at edges of geometry.
223+
GetShiftedNdotV(surfaceData.normalWS, V, twoSided);
224+
225+
// Orthonormalize the basis vectors using the Gram-Schmidt process.
226+
// We assume that the length of the surface normal is sufficiently close to 1.
227+
surfaceData.tangentWS = normalize(surfaceData.tangentWS - dot(surfaceData.tangentWS, surfaceData.normalWS));
228+
218229
// Caution: surfaceData must be fully initialize before calling GetBuiltinData
219230
GetBuiltinData(input, surfaceData, alpha, depthOffset, builtinData);
220231
}
@@ -419,10 +430,18 @@ void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs p
419430
normalTS = BlendLayeredFloat3(normalTS0, normalTS1, normalTS2, normalTS3, weights);
420431
#endif
421432
surfaceData.normalWS = TransformTangentToWorld(normalTS, input.tangentToWorld);
433+
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
434+
435+
bool twoSided = false;
436+
// This will potentially reduce the length of the normal at edges of geometry.
437+
GetShiftedNdotV(surfaceData.normalWS, V, twoSided);
438+
439+
// Orthonormalize the basis vectors using the Gram-Schmidt process.
440+
// We assume that the length of the surface normal is sufficiently close to 1.
441+
surfaceData.tangentWS = normalize(surfaceData.tangentWS - dot(surfaceData.tangentWS, surfaceData.normalWS));
422442

423443
// Init other unused parameter
424444
surfaceData.materialId = 0;
425-
surfaceData.tangentWS = input.tangentToWorld[0].xyz;
426445
surfaceData.anisotropy = 0;
427446
surfaceData.specular = 0.04;
428447
surfaceData.subSurfaceRadius = 1.0;

Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Resources/PreIntegratedFGD.shader

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ Shader "Hidden/HDRenderPipeline/PreIntegratedFGD"
4343
float3 V = float3(sqrt(1 - NdotV * NdotV), 0, NdotV);
4444
float3 N = float3(0.0, 0.0, 1.0);
4545

46-
const int numSamples = 2048;
47-
4846
// Pre integrate GGX with smithJoint visibility as well as DisneyDiffuse
49-
float4 preFGD = IntegrateGGXAndDisneyFGD(V, N, PerceptualRoughnessToRoughness(perceptualRoughness), numSamples);
47+
float4 preFGD = IntegrateGGXAndDisneyFGD(V, N, PerceptualRoughnessToRoughness(perceptualRoughness));
5048

5149
return float4(preFGD.xyz, 1.0);
5250
}

Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ void Frag( PackedVaryings packedInput,
1616
UpdatePositionInput(input.unPositionSS.z, input.unPositionSS.w, input.positionWS, posInput);
1717
float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS);
1818

19-
SurfaceData surfaceData;
20-
BuiltinData builtinData;
21-
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData);
19+
SurfaceData surfaceData;
20+
BuiltinData builtinData;
21+
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData);
22+
23+
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
2224

23-
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
2425
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
2526

2627
float3 diffuseLighting;

Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ void Frag( PackedVaryings packedInput,
2121
BuiltinData builtinData;
2222
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData);
2323

24-
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
24+
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
25+
2526
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
27+
2628
float3 bakeDiffuseLighting = GetBakedDiffuseLigthing(surfaceData, builtinData, bsdfData, preLightData);
2729

2830
ENCODE_INTO_GBUFFER(surfaceData, bakeDiffuseLighting, outGBuffer);

Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderVariables.hlsl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,16 @@ float3x3 CreateTangentToWorld(float3 normal, float3 tangent, float tangentSign)
295295
// Computes world space view direction, from object space position
296296
float3 GetWorldSpaceNormalizeViewDir(float3 positionWS)
297297
{
298-
return normalize(_WorldSpaceCameraPos.xyz - positionWS);
298+
float3 V = _WorldSpaceCameraPos.xyz - positionWS;
299+
300+
// Uncomment this once the compiler bug is fixed.
301+
// if (unity_OrthoParams.w == 1.0)
302+
// {
303+
// float4x4 M = GetWorldToViewMatrix();
304+
// V = M[1].xyz;
305+
// }
306+
307+
return normalize(V);
299308
}
300309

301310
float3 TransformTangentToWorld(float3 dirTS, float3 tangentToWorld[3])

Assets/ScriptableRenderLoop/ShaderLibrary/AreaLighting.hlsl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ float PolygonRadiance(float4x3 L, bool twoSided)
1818
{
1919
// 1. ClipQuadToHorizon
2020

21-
// detect clipping config
21+
// detect clipping config
2222
uint config = 0;
2323
if (L[0].z > 0) config += 1;
2424
if (L[1].z > 0) config += 2;
@@ -168,9 +168,8 @@ float PolygonRadiance(float4x3 L, bool twoSided)
168168
// For polygonal lights.
169169
float LTCEvaluate(float4x3 L, float3 V, float3 N, float NdotV, bool twoSided, float3x3 invM)
170170
{
171-
// Construct local orthonormal basis around N, aligned with N
172-
// TODO: it could be stored in PreLightData. All LTC lights compute it more than once!
173-
// Also consider using 'bsdfData.tangentWS', 'bsdfData.bitangentWS', 'bsdfData.normalWS'.
171+
// Construct a view-dependent orthonormal basis around N.
172+
// TODO: it could be stored in PreLightData, since all LTC lights compute it more than once.
174173
float3x3 basis;
175174
basis[0] = normalize(V - N * NdotV);
176175
basis[1] = normalize(cross(N, basis[0]));
@@ -202,7 +201,7 @@ float LineFwt(float tLDDL, float l)
202201
// 'normal' is the direction orthogonal to the tangent. It is the shortest vector between
203202
// the shaded point and the line, pointing away from the shaded point.
204203
float LineIrradiance(float l1, float l2, float3 normal, float3 tangent)
205-
{
204+
{
206205
float d = length(normal);
207206
float l1rcpD = l1 * rcp(d);
208207
float l2rcpD = l2 * rcp(d);

Assets/ScriptableRenderLoop/ShaderLibrary/BSDF.hlsl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ float3 F_Schlick(float3 f0, float u)
4242
// With analytical light (not image based light) we clamp the minimun roughness in the NDF to avoid numerical instability.
4343
#define UNITY_MIN_ROUGHNESS 0.002
4444

45-
float D_GGXNoPI(float NdotH, float roughness)
45+
float ClampRoughnessForAnalyticalLights(float roughness)
4646
{
47-
roughness = max(roughness, UNITY_MIN_ROUGHNESS);
47+
return max(roughness, UNITY_MIN_ROUGHNESS);
48+
}
4849

50+
float D_GGXNoPI(float NdotH, float roughness)
51+
{
4952
float a2 = roughness * roughness;
5053
float f = (NdotH * a2 - NdotH) * NdotH + 1.0;
5154
return a2 / (f * f);
@@ -58,8 +61,6 @@ float D_GGX(float NdotH, float roughness)
5861

5962
float D_GGX_Inverse(float NdotH, float roughness)
6063
{
61-
roughness = max(roughness, UNITY_MIN_ROUGHNESS);
62-
6364
float a2 = roughness * roughness;
6465
float f = (NdotH * a2 - NdotH) * NdotH + 1.0;
6566
float g = (f * f) / a2;
@@ -70,8 +71,6 @@ float D_GGX_Inverse(float NdotH, float roughness)
7071
// Ref: Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs, p. 19, 29.
7172
float G_MaskingSmithGGX(float NdotV, float VdotH, float roughness)
7273
{
73-
roughness = max(roughness, UNITY_MIN_ROUGHNESS);
74-
7574
// G1(V, H) = HeavisideStep(VdotH) / (1 + Λ(V)).
7675
// Λ(V) = -0.5 + 0.5 * sqrt(1 + 1 / a²).
7776
// a = 1 / (roughness * tan(theta)).
@@ -100,7 +99,7 @@ float V_SmithJointGGX(float NdotL, float NdotV, float roughness)
10099
// lambda_l = (-1 + sqrt(a2 * (1 - NdotV2) / NdotV2 + 1)) * 0.5f;
101100
// G = 1 / (1 + lambda_v + lambda_l);
102101

103-
float a = roughness;
102+
float a = roughness;
104103
float a2 = a * a;
105104
// Reorder code to be more optimal
106105
float lambdaV = NdotL * sqrt((-NdotV * a2 + NdotV) * NdotV + a2);
@@ -161,9 +160,6 @@ float V_SmithJointGGXApprox(float NdotL, float NdotV, float roughness, float lam
161160
// roughnessB -> roughness in bitangent direction
162161
float D_GGXAnisoNoPI(float TdotH, float BdotH, float NdotH, float roughnessT, float roughnessB)
163162
{
164-
roughnessT = max(roughnessT, UNITY_MIN_ROUGHNESS);
165-
roughnessB = max(roughnessB, UNITY_MIN_ROUGHNESS);
166-
167163
float f = TdotH * TdotH / (roughnessT * roughnessT) + BdotH * BdotH / (roughnessB * roughnessB) + NdotH * NdotH;
168164
return 1.0 / (roughnessT * roughnessB * f * f);
169165
}

0 commit comments

Comments
 (0)