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:
TriVoxel
2025-04-28 06:12:27 -06:00
parent ddc3a071f4
commit 0cdb90bdb8
5 changed files with 247 additions and 93 deletions

View 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