diff options
author | tagcup <tagcup@yahoo.com> | 2018-09-30 14:31:30 -0400 |
---|---|---|
committer | tagcup <tagcup@yahoo.com> | 2018-09-30 16:33:50 -0400 |
commit | 9f4e9fcb8113e668d0a02849841137b300a0e270 (patch) | |
tree | dfc844484252aa9b44538afd1e09990ad012403d /drivers/gles3 | |
parent | e94f6aaceedf42c3fc9f043c9d77552d147eb4db (diff) |
Optimized GGX G function for GLES2.
Also changed the mapping of anisotropy to match the common definition.
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index a94558a58a..598bd3465e 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -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); |