diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-12-02 16:28:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-12-04 12:10:27 +0300 |
commit | 5b6cfa705cb180d042f6f27e45331c12972be7ae (patch) | |
tree | 931f935dedd2bc3ce87066f09879b7cf10a32e8c /source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl | |
parent | 847f568bf5f2aed8904066895e175da7118522e7 (diff) |
Eevee: Irradiance Visibility: Initial Implementation
This augment the existing irradiance grid with a new visibility precomputation.
We store a small shadowmap for each grid sample so that light does not leak through walls and such.
The visibility parameter are similar to the one used by the Variance Shadow Map for point lights.
Technical details:
We store the visibility in the same texture (array) as the irradiance itself (in order to reduce the number of sampler).
But the irradiance and the visibility are not the same data so we must encode them in order to use the same texture format.
We use RGBA8 normalized texture and encode irradiance as RGBE (shared exponent).
Using RGBE encoding instead of R11_G11_B10 may lead to some lighting changes, but quality seems to be nearly the same in my test cases.
Using full RGBA16/32F maybe a future option but that will require much more memory and reduce the perf significantly.
Visibility moments (VSM) are encoded as 16bits fixed point precision using a special range. This seems to retain enough precision for the needs.
Also interpolation does not seems to be big problem (even though it's incorrect).
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl index b3f5e8b60ad..1376c53d633 100644 --- a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl @@ -128,12 +128,16 @@ vec3 light_volume_shadow(LightData ld, vec3 ray_wpos, vec4 l_vector, sampler3D v #ifdef IRRADIANCE_LIB vec3 irradiance_volumetric(vec3 wpos) { +#ifdef IRRADIANCE_HL2 IrradianceData ir_data = load_irradiance_cell(0, vec3(1.0)); vec3 irradiance = ir_data.cubesides[0] + ir_data.cubesides[1] + ir_data.cubesides[2]; ir_data = load_irradiance_cell(0, vec3(-1.0)); irradiance += ir_data.cubesides[0] + ir_data.cubesides[1] + ir_data.cubesides[2]; irradiance *= 0.16666666; /* 1/6 */ return irradiance; +#else + return vec3(0.0); +#endif } #endif |