diff options
author | Ptolemy <ptolemy@lindenlab.com> | 2022-08-23 02:22:03 -0700 |
---|---|---|
committer | Ptolemy <ptolemy@lindenlab.com> | 2022-08-23 02:22:03 -0700 |
commit | 5e41024b9c02176ccfe292f067fb34f0607e59d5 (patch) | |
tree | c8f8078824e498b91ac1401b135556456fd78b09 /indra/newview/app_settings/shaders/class1 | |
parent | f8974f4d783521846a985dd3d08067bd8e7f66a2 (diff) |
SL-17703: PBR: Move IOR calcF0() to deferred utils
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index bb1265802a..8a3eb39ae7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -298,6 +298,23 @@ vec3 hue_to_rgb(float hue) // PBR Utils +// ior Index of Refraction, normally 1.5 +// returns reflect0 +float calcF0(float ior) +{ + float f0 = (1.0 - ior) / (1.0 + ior); + return f0 * f0; +} + +vec3 fresnel(float vh, vec3 f0, vec3 f90 ) +{ + float x = 1.0 - abs(vh); + float x2 = x*x; + float x5 = x2*x2*x; + vec3 fr = f0 + (f90 - f0)*x5; + return fr; +} + vec3 fresnelSchlick( vec3 reflect0, vec3 reflect90, float vh) { return reflect0 + (reflect90 - reflect0) * pow(clamp(1.0 - vh, 0.0, 1.0), 5.0); |