WIP: eevee-next-world-irradiance #108304
|
@ -24,14 +24,7 @@ namespace blender::eevee {
|
|||
|
||||
void Sampling::init(const Scene *scene)
|
||||
{
|
||||
if (inst_.is_baking()) {
|
||||
sample_count_ = max_ii(1, scene->eevee.gi_irradiance_samples);
|
||||
sample_ = 0;
|
||||
}
|
||||
else {
|
||||
sample_count_ = inst_.is_viewport() ? scene->eevee.taa_samples :
|
||||
scene->eevee.taa_render_samples;
|
||||
}
|
||||
sample_count_ = inst_.is_viewport() ? scene->eevee.taa_samples : scene->eevee.taa_render_samples;
|
||||
|
||||
if (sample_count_ == 0) {
|
||||
BLI_assert(inst_.is_viewport());
|
||||
|
|
|
@ -58,10 +58,7 @@ void main()
|
|||
|
||||
lightprobe_eval(diffuse_data, reflection_data, P, Ng, V, diffuse_light, reflection_light);
|
||||
|
||||
light_world_eval(diffuse_data, reflection_data, P, V, diffuse_light, reflection_light);
|
||||
|
||||
light_eval(
|
||||
diffuse_data, reflection_data, P, Ng, V, vP_z, thickness, diffuse_light, reflection_light);
|
||||
light_world_eval(reflection_data, P, V, reflection_light);
|
||||
|
||||
light_eval(diffuse_data,
|
||||
reflection_data,
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
/**
|
||||
* Accumulate light from a bounce of indirect light into each surfel radiance.
|
||||
* This feeds back the light for the next bounce.
|
||||
*
|
||||
* Dispatched as one thread per surfel.
|
||||
*/
|
||||
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_math_base_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
|
||||
vec3 finalize_integration(vec4 radiance)
|
||||
{
|
||||
/* Divide by sample count. */
|
||||
radiance.rgb *= safe_rcp(radiance.w);
|
||||
/* TODO: Find why this is needed. */
|
||||
radiance.rgb *= 2.0;
|
||||
/* Multiply by hemisphere area since we are integrating over it. */
|
||||
return radiance.rgb * M_TAU;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int surfel_index = int(gl_GlobalInvocationID.x);
|
||||
if (surfel_index >= capture_info_buf.surfel_len) {
|
||||
return;
|
||||
}
|
||||
Surfel surfel = surfel_buf[surfel_index];
|
||||
vec3 radiance_front = finalize_integration(surfel.incomming_light_front);
|
||||
vec3 radiance_back = finalize_integration(surfel.incomming_light_back);
|
||||
/* Re-inject the bounced light for the next bounce event. */
|
||||
surfel_buf[surfel_index].outgoing_light_front = radiance_front;
|
||||
surfel_buf[surfel_index].outgoing_light_back = radiance_back;
|
||||
/* Add to final radiance. */
|
||||
surfel_buf[surfel_index].radiance_front += radiance_front;
|
||||
surfel_buf[surfel_index].radiance_back += radiance_back;
|
||||
/* Reset accumulator for next bounce. */
|
||||
surfel_buf[surfel_index].incomming_light_front = vec4(0.0);
|
||||
surfel_buf[surfel_index].incomming_light_back = vec4(0.0);
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(cubemap_lib.glsl)
|
||||
|
||||
void radiance_transfer(inout Surfel surfel, vec3 irradiance, vec3 L)
|
||||
void radiance_transfer(inout Surfel surfel, vec3 in_radiance, vec3 L)
|
||||
{
|
||||
float NL = dot(surfel.normal, L);
|
||||
/* Lambertian BSDF. Albedo applied later depending on which side of the surfel was hit. */
|
||||
|
@ -70,6 +70,11 @@ void radiance_transfer_world(inout Surfel receiver, vec3 sky_L)
|
|||
radiance_transfer(receiver, radiance, -sky_L);
|
||||
}
|
||||
|
||||
vec3 radiance_sky_sample(vec3 R)
|
||||
{
|
||||
return textureLod_cubemapArray(reflectionProbes, vec4(R, 0.0), 0.0).rgb;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int surfel_index = int(gl_GlobalInvocationID.x);
|
||||
|
@ -99,6 +104,5 @@ void main()
|
|||
radiance_transfer(surfel, world_radiance, -sky_L);
|
||||
}
|
||||
|
||||
surfel_buf[surfel_index].incomming_light_front = surfel.incomming_light_front;
|
||||
surfel_buf[surfel_index].incomming_light_back = surfel.incomming_light_back;
|
||||
surfel_buf[surfel_index] = surfel;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_light)
|
|||
"eevee_light_data",
|
||||
"eevee_lightprobe_data",
|
||||
"eevee_reflection_probe_data",
|
||||
"eevee_lightprobe_data",
|
||||
"eevee_shadow_data",
|
||||
"eevee_deferred_base",
|
||||
"eevee_transmittance_data",
|
||||
|
|
|
@ -165,7 +165,6 @@
|
|||
#define _DNA_DEFAULT_SceneEEVEE \
|
||||
{ \
|
||||
.gi_diffuse_bounces = 3, \
|
||||
.gi_irradiance_samples = 512, \
|
||||
.gi_cubemap_resolution = 512, \
|
||||
.gi_visibility_resolution = 32, \
|
||||
.gi_cubemap_draw_size = 0.3f, \
|
||||
|
|
|
@ -1787,7 +1787,6 @@ typedef struct SceneDisplay {
|
|||
typedef struct SceneEEVEE {
|
||||
int flag;
|
||||
int gi_diffuse_bounces;
|
||||
int gi_irradiance_samples;
|
||||
int gi_cubemap_resolution;
|
||||
int gi_visibility_resolution;
|
||||
float gi_irradiance_smoothing;
|
||||
|
|
|
@ -7449,14 +7449,6 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
|||
RNA_def_property_range(prop, 0, INT_MAX);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_irradiance_samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Diffuse Samples",
|
||||
"Number of rays direction to evaluate when baking a single "
|
||||
"bounce of indirect lighting");
|
||||
RNA_def_property_range(prop, 0, INT_MAX);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, eevee_shadow_size_items);
|
||||
RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps");
|
||||
|
|
Loading…
Reference in New Issue