Skip to content

Commit fe911bd

Browse files
committed
fix: reflect vector (it was not negative viewDir fml)
1 parent 336749f commit fe911bd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

shader/brdf.cginc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,8 @@ float3 PrepareIndirectSpecularTerm(in LightingData ld)
251251

252252
float3 Fr = E * ld.indirectSpecular;
253253

254-
// specular calculated AO (using AO from tex)
255254
Fr *= ComputeSpecularAO(ld.NoV, _Occlusion, _Roughness);
256-
//horizon AO
255+
257256
Fr *= ld.horizon * ld.horizon;
258257

259258
return Fr;

shader/util/util.cginc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void InitAnisotropyData(inout AnisotropyData ad, in LightingData ld, in v2f i) {
3939
float3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);
4040
float bendFactor = abs(ad.strength) * saturate(5.0 * _RoughnessPerceptual);
4141
float3 bentNormal = normalize(lerp(_NormalWS, anisotropicNormal, bendFactor));
42-
ad.r = reflect(ld.viewDir, bentNormal);
42+
ad.r = reflect(-ld.viewDir, bentNormal);
4343
#endif
4444
}
4545

@@ -219,7 +219,7 @@ void InitLightingData(inout v2f i, inout LightingData ld, inout VertexLightingDa
219219
ld.f0 = f0;
220220

221221
float3 h = normalize(lightDir + viewDir);
222-
float3 r = reflect(viewDir, _NormalWS);
222+
float3 r = reflect(-viewDir, _NormalWS);
223223
float NoV = abs(dot(_NormalWS, viewDir)) + 1e-5;
224224
float NoL = clamp(dot(_NormalWS, lightDir), 0.0, 1.0);
225225
float LoV = clamp(dot(lightDir, viewDir), 0.0, 1.0);

0 commit comments

Comments
 (0)