Optimized GGX G function for GLES2.

Also changed the mapping of anisotropy to match the common definition.
This commit is contained in:
tagcup 2018-09-30 14:31:30 -04:00
parent e94f6aacee
commit 9f4e9fcb81
2 changed files with 56 additions and 26 deletions

View file

@ -1070,11 +1070,10 @@ LIGHT_SHADER_CODE
#if defined(LIGHT_USE_ANISOTROPY)
float alpha = roughness * roughness;
float aspect = sqrt(1.0 - anisotropy * 0.9);
float rx = roughness / aspect;
float ry = roughness * aspect;
float ax = rx * rx;
float ay = ry * ry;
float ax = alpha / aspect;
float ay = alpha * aspect;
float XdotH = dot(T, H);
float YdotH = dot(B, H);
float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);