From 5e41024b9c02176ccfe292f067fb34f0607e59d5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 23 Aug 2022 02:22:03 -0700 Subject: SL-17703: PBR: Move IOR calcF0() to deferred utils --- .../shaders/class1/deferred/deferredUtil.glsl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/app_settings/shaders/class1') 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); -- cgit v1.2.3