Cleanup: EEVEE: Remove unused IRRADIANCE_CUBEMAP
This commit is contained in:
parent
47885abbe6
commit
37a8c6d809
|
@ -53,9 +53,6 @@
|
|||
#if defined(IRRADIANCE_SH_L2)
|
||||
# define IRRADIANCE_SAMPLE_SIZE_X 4 /* 3 in reality */
|
||||
# define IRRADIANCE_SAMPLE_SIZE_Y 4 /* 3 in reality */
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
# define IRRADIANCE_SAMPLE_SIZE_X 8
|
||||
# define IRRADIANCE_SAMPLE_SIZE_Y 8
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
# define IRRADIANCE_SAMPLE_SIZE_X 4 /* 3 in reality */
|
||||
# define IRRADIANCE_SAMPLE_SIZE_Y 2
|
||||
|
|
|
@ -179,8 +179,6 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
if (!sldata->fallback_lightcache) {
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
int grid_res = 4;
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
int grid_res = 8;
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
int grid_res = 4;
|
||||
#endif
|
||||
|
@ -1114,9 +1112,6 @@ void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata,
|
|||
/* NOTE : Keep in sync with load_irradiance_cell() */
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
int size[2] = {3, 3};
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
int size[2] = {8, 8};
|
||||
pinfo->samples_len = 1024.0f;
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
int size[2] = {3, 2};
|
||||
pinfo->samples_len = 1024.0f;
|
||||
|
|
|
@ -170,8 +170,6 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
|
|||
if (stl->lookdev_lightcache == NULL) {
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
int grid_res = 4;
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
int grid_res = 8;
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
int grid_res = 4;
|
||||
#endif
|
||||
|
|
|
@ -53,14 +53,11 @@ extern struct DrawEngineType draw_engine_eevee_type;
|
|||
|
||||
/* Only define one of these. */
|
||||
// #define IRRADIANCE_SH_L2
|
||||
// #define IRRADIANCE_CUBEMAP
|
||||
#define IRRADIANCE_HL2
|
||||
#define HAMMERSLEY_SIZE 1024
|
||||
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
# define SHADER_IRRADIANCE "#define IRRADIANCE_SH_L2\n"
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
# define SHADER_IRRADIANCE "#define IRRADIANCE_CUBEMAP\n"
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
# define SHADER_IRRADIANCE "#define IRRADIANCE_HL2\n"
|
||||
#endif
|
||||
|
|
|
@ -3,11 +3,7 @@ uniform sampler2DArray irradianceGrid;
|
|||
|
||||
#define IRRADIANCE_LIB
|
||||
|
||||
#ifdef IRRADIANCE_CUBEMAP
|
||||
struct IrradianceData {
|
||||
vec3 color;
|
||||
};
|
||||
#elif defined(IRRADIANCE_SH_L2)
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
struct IrradianceData {
|
||||
vec3 shcoefs[9];
|
||||
};
|
||||
|
@ -21,24 +17,7 @@ IrradianceData load_irradiance_cell(int cell, vec3 N)
|
|||
{
|
||||
/* Keep in sync with diffuse_filter_probe() */
|
||||
|
||||
#if defined(IRRADIANCE_CUBEMAP)
|
||||
|
||||
# define AMBIANT_CUBESIZE 8
|
||||
ivec2 cell_co = ivec2(AMBIANT_CUBESIZE);
|
||||
int cell_per_row = textureSize(irradianceGrid, 0).x / cell_co.x;
|
||||
cell_co.x *= cell % cell_per_row;
|
||||
cell_co.y *= cell / cell_per_row;
|
||||
|
||||
vec2 texelSize = 1.0 / vec2(AMBIANT_CUBESIZE);
|
||||
|
||||
vec2 uvs = mapping_octahedron(N, texelSize);
|
||||
uvs *= vec2(AMBIANT_CUBESIZE) / vec2(textureSize(irradianceGrid, 0));
|
||||
uvs += vec2(cell_co) / vec2(textureSize(irradianceGrid, 0));
|
||||
|
||||
IrradianceData ir;
|
||||
ir.color = texture(irradianceGrid, vec3(uvs, 0.0)).rgb;
|
||||
|
||||
#elif defined(IRRADIANCE_SH_L2)
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
|
||||
ivec2 cell_co = ivec2(3, 3);
|
||||
int cell_per_row = textureSize(irradianceGrid, 0).x / cell_co.x;
|
||||
|
@ -164,9 +143,7 @@ vec3 hl2_basis(vec3 N, vec3 cubesides[3])
|
|||
|
||||
vec3 compute_irradiance(vec3 N, IrradianceData ird)
|
||||
{
|
||||
#if defined(IRRADIANCE_CUBEMAP)
|
||||
return ird.color;
|
||||
#elif defined(IRRADIANCE_SH_L2)
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
return spherical_harmonics_L2(N, ird.shcoefs);
|
||||
#else /* defined(IRRADIANCE_HL2) */
|
||||
return hl2_basis(N, ird.cubesides);
|
||||
|
|
|
@ -111,32 +111,7 @@ void main()
|
|||
|
||||
FragColor = vec4(sh, 1.0);
|
||||
#else
|
||||
# if defined(IRRADIANCE_CUBEMAP)
|
||||
/* Downside: Need lots of memory for storage, distortion due to octahedral mapping */
|
||||
const vec2 map_size = vec2(16.0);
|
||||
const vec2 texelSize = 1.0 / map_size;
|
||||
vec2 uvs = mod(gl_FragCoord.xy, map_size) * texelSize;
|
||||
const float paddingSize = 1.0;
|
||||
|
||||
/* Add a N pixel border to ensure filtering is correct
|
||||
* for N mipmap levels. */
|
||||
uvs = (uvs - texelSize * paddingSize) / (1.0 - 2.0 * texelSize * paddingSize);
|
||||
|
||||
/* edge mirroring : only mirror if directly adjacent
|
||||
* (not diagonally adjacent) */
|
||||
vec2 m = abs(uvs - 0.5) + 0.5;
|
||||
vec2 f = floor(m);
|
||||
if (f.x - f.y != 0.0) {
|
||||
uvs = 1.0 - uvs;
|
||||
}
|
||||
|
||||
/* clamp to [0-1] */
|
||||
uvs = fract(uvs);
|
||||
|
||||
/* get cubemap vector */
|
||||
vec3 cubevec = octahedral_to_cubemap_proj(uvs);
|
||||
|
||||
# elif defined(IRRADIANCE_HL2)
|
||||
# if defined(IRRADIANCE_HL2)
|
||||
/* Downside: very very low resolution (6 texels), bleed lighting because of interpolation */
|
||||
int x = int(gl_FragCoord.x) % 3;
|
||||
int y = int(gl_FragCoord.y) % 2;
|
||||
|
|
|
@ -6,8 +6,6 @@ void main()
|
|||
{
|
||||
#if defined(IRRADIANCE_SH_L2)
|
||||
const ivec2 data_size = ivec2(3, 3);
|
||||
#elif defined(IRRADIANCE_CUBEMAP)
|
||||
const ivec2 data_size = ivec2(8, 8);
|
||||
#elif defined(IRRADIANCE_HL2)
|
||||
const ivec2 data_size = ivec2(3, 2);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue