#ifndef _ENVIRONMENT_SAMPLE_GLSL_ #define _ENVIRONMENT_SAMPLE_GLSL_ // Sample diffuse ambient environment lighting (irradiance) vec3 sampleDiffuseEnvironment(vec3 normal) { #ifdef _Irr vec3 envl = shIrradiance(normal, shirr); #ifdef _EnvTex envl /= PI; #endif return envl; #else return vec3(0.0); #endif } // Sample specular environment reflection (skybox or cubemap) vec3 sampleSpecularEnvironment(vec3 viewDir, float roughness) { #ifdef _EnvTex return textureLod(texEnvironment, viewDir, roughness * 8.0).rgb; #else return vec3(0.0); #endif } #endif