Skip to content

Commit

Permalink
fix: anisotropy works without Surface
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Jul 29, 2020
1 parent 60caa7e commit b5c3280
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/examples/brdfs/specularAnisotropic/fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ uniform sampler2D specularAnisotropicFlowMap;
#pragma include <brdfs/specular/anisotropy>
#pragma include <color/spaces/srgb>
#pragma include <normals/tangentSpace>
#pragma include <math/mat2>
#pragma include <math/mat3>

void main() {
Expand All @@ -33,8 +34,9 @@ void main() {
vec3 viewDirection = normalize( -v_viewSurfacePosition );

mat3 tangentToView = tangentToViewFromPositionNormalUV( position, normal, v_uv0 );
tangentToView = tangentToView * mat3RotateZDirection( normalize( specularAnisotropicFlow ).yx );
tangentToView = tangentToView * mat3RotateZDirection( normalize( specularAnisotropicFlow ) * mat2Rotate( degToRad( 90. ) ) );
tangentToView[2] = bendNormalForAnistropicReflections( viewDirection, tangentToView, length( specularAnisotropicFlow ), specularRoughness );

normal = tangentToView[2];

PunctualLight punctualLight;
Expand Down

0 comments on commit b5c3280

Please sign in to comment.