Skip to content

Instantly share code, notes, and snippets.

@romainguy
Last active February 9, 2023 02:48
Show Gist options
  • Save romainguy/113e3f35f47c1a53ace9b392691b98cd to your computer and use it in GitHub Desktop.
Save romainguy/113e3f35f47c1a53ace9b392691b98cd to your computer and use it in GitHub Desktop.
Anisotropic IBL
vec3 anisotropyDirection = pixel.anisotropy >= 0.0 ? pixel.anisotropicB : pixel.anisotropicT;
vec3 anisotropicTangent = cross(anisotropyDirection, shading_view);
vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);
float bendFactor = abs(pixel.anisotropy) * saturate(5.0 * pixel.roughness);
vec3 bentNormal = normalize(mix(shading_normal, anisotropicNormal, bendFactor));
vec3 r = reflect(-shading_view, bentNormal);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment