ADD: Lighting modifier and IBL probe

This commit is contained in:
2025-11-27 21:49:25 +09:00
parent 2182b02f4a
commit 67ab04f798
11 changed files with 401 additions and 45 deletions

View File

@@ -16,6 +16,8 @@ void main()
vec3 worldDir = normalize((inverse(sceneData.view) * vec4(viewDir, 0.0)).xyz);
vec2 uv = dir_to_equirect(worldDir);
vec3 col = textureLod(iblSpec2D, uv, 0.0).rgb;
// Sample a dedicated background environment map when available.
// The engine binds iblBackground2D to a texture that may differ from the IBL specular map.
vec3 col = textureLod(iblBackground2D, uv, 0.0).rgb;
outColor = vec4(col, 1.0);
}

View File

@@ -1,10 +1,11 @@
#ifndef IBL_COMMON_GLSL
#define IBL_COMMON_GLSL
// IBL bindings (set=3): specular equirect 2D, BRDF LUT, SH UBO.
// IBL bindings (set=3): specular equirect 2D, BRDF LUT, SH UBO, optional background map.
layout(set=3, binding=0) uniform sampler2D iblSpec2D;
layout(set=3, binding=1) uniform sampler2D iblBRDF;
layout(std140, set=3, binding=2) uniform IBL_SH { vec4 sh[9]; } iblSH;
layout(set=3, binding=3) uniform sampler2D iblBackground2D;
// Evaluate diffuse irradiance from 2nd-order SH coefficients (9 coeffs).
// Coefficients are pre-convolved with the Lambert kernel on the CPU.