UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

19 lines (18 loc) 987 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{glsl as e}from"../../shaderModules/glsl.js";function t(t){const a=t.fragment.code;a.add(e`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) { return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5; }`),a.add(e`float integratedRadiance(float cosTheta2, float roughness) { return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0); }`),a.add(e`vec3 evaluateSpecularIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float RdotNG, float roughness) { float cosTheta2 = 1.0 - RdotNG * RdotNG; float intRadTheta = integratedRadiance(cosTheta2, roughness); float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta; float sky = 2.0 - ground; return (ground * ambientGround + sky * ambientSky) * 0.5; }`)}export{t as AnalyticalSkyModel};