Math fixes, SSR enhancements, improved precision and image sharpness, moved envmap into its own shader to improve SSR realism. Various improvements.
This commit is contained in:
28
leenkx/Shaders/std/environment_sample.glsl
Normal file
28
leenkx/Shaders/std/environment_sample.glsl
Normal file
@ -0,0 +1,28 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user