Eevee: Probes: Add support for intensity tweak.
This works for grid and cubemaps. The intensity is baked into the map itself. Thus you need to refresh/rebake the probe to see the changes.
This commit is contained in:
parent
73a1bf1a80
commit
777e1d358a
|
@ -64,30 +64,22 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
|
|||
|
||||
if probe.type == 'GRID':
|
||||
col = split.column(align=True)
|
||||
col.label("Influence:")
|
||||
col.prop(probe, "influence_distance", "Distance")
|
||||
col.prop(probe, "falloff")
|
||||
col.prop(probe, "intensity")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.label("Resolution:")
|
||||
col.prop(probe, "grid_resolution_x", text="X")
|
||||
col.prop(probe, "grid_resolution_y", text="Y")
|
||||
col.prop(probe, "grid_resolution_z", text="Z")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.label("Influence:")
|
||||
col.prop(probe, "influence_distance", "Distance")
|
||||
col.prop(probe, "falloff")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.label("Visibily:")
|
||||
col.prop(probe, "visibility_buffer_bias", "Bias")
|
||||
col.prop(probe, "visibility_bleed_bias", "Bleed Bias")
|
||||
col.prop(probe, "visibility_blur", "Blur")
|
||||
|
||||
elif probe.type == 'PLANAR':
|
||||
col = split.column(align=True)
|
||||
col.label("Influence:")
|
||||
col.prop(probe, "influence_distance", "Distance")
|
||||
col.prop(probe, "falloff")
|
||||
|
||||
else:
|
||||
col = split.column(align=True)
|
||||
col.label("Influence:")
|
||||
|
@ -99,14 +91,24 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
|
|||
col.prop(probe, "influence_distance", "Size")
|
||||
|
||||
col.prop(probe, "falloff")
|
||||
col.prop(probe, "intensity")
|
||||
|
||||
col = split.column(align=True)
|
||||
|
||||
col.label("Clipping:")
|
||||
col.prop(probe, "clip_start", text="Start")
|
||||
|
||||
if probe.type != "PLANAR":
|
||||
col.prop(probe, "clip_end", text="End")
|
||||
|
||||
if probe.type == 'GRID':
|
||||
col.separator()
|
||||
|
||||
col.label("Visibily:")
|
||||
col.prop(probe, "visibility_buffer_bias", "Bias")
|
||||
col.prop(probe, "visibility_bleed_bias", "Bleed Bias")
|
||||
col.prop(probe, "visibility_blur", "Blur")
|
||||
|
||||
|
||||
class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel):
|
||||
bl_label = "Parallax"
|
||||
|
|
|
@ -52,6 +52,7 @@ void BKE_lightprobe_init(LightProbe *probe)
|
|||
probe->clipend = 40.0f;
|
||||
probe->vis_bias = 1.0f;
|
||||
probe->vis_blur = 0.2f;
|
||||
probe->intensity = 1.0f;
|
||||
probe->data_draw_size = 1.0f;
|
||||
|
||||
probe->flag = LIGHTPROBE_FLAG_SHOW_INFLUENCE | LIGHTPROBE_FLAG_SHOW_DATA;
|
||||
|
|
|
@ -915,4 +915,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "intensity")) {
|
||||
for (LightProbe *probe = main->lightprobe.first; probe; probe = probe->id.next) {
|
||||
probe->intensity = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -436,14 +436,15 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
|
|||
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
|
||||
|
||||
DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_filter_glossy_sh, psl->probe_glossy_compute, geom);
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &sldata->probes->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &sldata->probes->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "roughnessSquared", &sldata->probes->roughness, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodFactor", &sldata->probes->lodfactor, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodMax", &sldata->probes->lod_rt_max, 1);
|
||||
DRW_shgroup_uniform_float(grp, "texelSize", &sldata->probes->texel_size, 1);
|
||||
DRW_shgroup_uniform_float(grp, "paddingSize", &sldata->probes->padding_size, 1);
|
||||
DRW_shgroup_uniform_int(grp, "Layer", &sldata->probes->layer, 1);
|
||||
DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "roughnessSquared", &pinfo->roughness, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
|
||||
DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1);
|
||||
DRW_shgroup_uniform_float(grp, "paddingSize", &pinfo->padding_size, 1);
|
||||
DRW_shgroup_uniform_int(grp, "Layer", &pinfo->layer, 1);
|
||||
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
|
||||
// DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter);
|
||||
DRW_shgroup_uniform_texture(grp, "probeHdr", sldata->probe_rt);
|
||||
|
@ -456,14 +457,15 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
|
|||
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_filter_diffuse_sh, psl->probe_diffuse_compute);
|
||||
#ifdef IRRADIANCE_SH_L2
|
||||
DRW_shgroup_uniform_int(grp, "probeSize", &sldata->probes->shres, 1);
|
||||
DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1);
|
||||
#else
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &sldata->probes->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &sldata->probes->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodFactor", &sldata->probes->lodfactor, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodMax", &sldata->probes->lod_rt_max, 1);
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
|
||||
DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
|
||||
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
|
||||
#endif
|
||||
DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
|
||||
DRW_shgroup_uniform_texture(grp, "probeHdr", sldata->probe_rt);
|
||||
|
||||
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
|
||||
|
@ -474,14 +476,14 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
|
|||
psl->probe_visibility_compute = DRW_pass_create("LightProbe Visibility Compute", DRW_STATE_WRITE_COLOR);
|
||||
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_filter_visibility_sh, psl->probe_visibility_compute);
|
||||
DRW_shgroup_uniform_int(grp, "outputSize", &sldata->probes->shres, 1);
|
||||
DRW_shgroup_uniform_float(grp, "visibilityRange", &sldata->probes->visibility_range, 1);
|
||||
DRW_shgroup_uniform_float(grp, "visibilityBlur", &sldata->probes->visibility_blur, 1);
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &sldata->probes->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &sldata->probes->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "storedTexelSize", &sldata->probes->texel_size, 1);
|
||||
DRW_shgroup_uniform_float(grp, "nearClip", &sldata->probes->near_clip, 1);
|
||||
DRW_shgroup_uniform_float(grp, "farClip", &sldata->probes->far_clip, 1);
|
||||
DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1);
|
||||
DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1);
|
||||
DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1);
|
||||
DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "invSampleCount", &pinfo->invsamples_ct, 1);
|
||||
DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1);
|
||||
DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1);
|
||||
DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1);
|
||||
DRW_shgroup_uniform_texture(grp, "texHammersley", e_data.hammersley);
|
||||
DRW_shgroup_uniform_texture(grp, "probeDepth", sldata->probe_depth_rt);
|
||||
|
||||
|
@ -961,10 +963,13 @@ static void downsample_planar(void *vedata, int level)
|
|||
}
|
||||
|
||||
/* Glossy filter probe_rt to probe_pool at index probe_idx */
|
||||
static void glossy_filter_probe(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, EEVEE_PassList *psl, int probe_idx)
|
||||
static void glossy_filter_probe(
|
||||
EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, EEVEE_PassList *psl, int probe_idx, float intensity)
|
||||
{
|
||||
EEVEE_LightProbesInfo *pinfo = sldata->probes;
|
||||
|
||||
pinfo->intensity_fac = intensity;
|
||||
|
||||
/* Max lod used from the render target probe */
|
||||
pinfo->lod_rt_max = floorf(log2f(pinfo->target_size)) - 2.0f;
|
||||
|
||||
|
@ -1036,11 +1041,13 @@ static void glossy_filter_probe(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata,
|
|||
/* Diffuse filter probe_rt to irradiance_pool at index probe_idx */
|
||||
static void diffuse_filter_probe(
|
||||
EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, EEVEE_PassList *psl, int offset,
|
||||
float clipsta, float clipend, float vis_range, float vis_blur)
|
||||
float clipsta, float clipend, float vis_range, float vis_blur, float intensity)
|
||||
{
|
||||
EEVEE_CommonUniformBuffer *common_data = &sldata->common_data;
|
||||
EEVEE_LightProbesInfo *pinfo = sldata->probes;
|
||||
|
||||
pinfo->intensity_fac = intensity;
|
||||
|
||||
int pool_size[3];
|
||||
irradiance_pool_size_get(common_data->prb_irradiance_vis_size, pinfo->total_irradiance_samples, pool_size);
|
||||
|
||||
|
@ -1370,11 +1377,11 @@ static void lightprobes_refresh_world(EEVEE_ViewLayerData *sldata, EEVEE_Data *v
|
|||
|
||||
render_world_to_probe(sldata, psl);
|
||||
if (e_data.update_world & PROBE_UPDATE_CUBE) {
|
||||
glossy_filter_probe(sldata, vedata, psl, 0);
|
||||
glossy_filter_probe(sldata, vedata, psl, 0, 1.0);
|
||||
common_data->prb_num_render_cube = 1;
|
||||
}
|
||||
if (e_data.update_world & PROBE_UPDATE_GRID) {
|
||||
diffuse_filter_probe(sldata, vedata, psl, 0, 0.0, 0.0, 0.0, 0.0);
|
||||
diffuse_filter_probe(sldata, vedata, psl, 0, 0.0, 0.0, 0.0, 0.0, 1.0);
|
||||
SWAP(GPUTexture *, sldata->irradiance_pool, sldata->irradiance_rt);
|
||||
DRW_framebuffer_texture_detach(sldata->probe_pool);
|
||||
DRW_framebuffer_texture_attach(sldata->probe_filter_fb, sldata->irradiance_rt, 0, 0);
|
||||
|
@ -1473,7 +1480,7 @@ static void lightprobes_refresh_cube(EEVEE_ViewLayerData *sldata, EEVEE_Data *ve
|
|||
}
|
||||
LightProbe *prb = (LightProbe *)ob->data;
|
||||
render_scene_to_probe(sldata, vedata, ob->obmat[3], prb->clipsta, prb->clipend);
|
||||
glossy_filter_probe(sldata, vedata, psl, i);
|
||||
glossy_filter_probe(sldata, vedata, psl, i, prb->intensity);
|
||||
ped->need_update = false;
|
||||
ped->probe_id = i;
|
||||
if (!ped->ready_to_shade) {
|
||||
|
@ -1576,7 +1583,8 @@ static void lightprobes_refresh_all_no_world(EEVEE_ViewLayerData *sldata, EEVEE_
|
|||
}
|
||||
render_scene_to_probe(sldata, vedata, pos, prb->clipsta, prb->clipend);
|
||||
diffuse_filter_probe(sldata, vedata, psl, egrid->offset + cell_id,
|
||||
prb->clipsta, prb->clipend, egrid->visibility_range, prb->vis_blur);
|
||||
prb->clipsta, prb->clipend, egrid->visibility_range, prb->vis_blur,
|
||||
prb->intensity);
|
||||
/* To see what is going on. */
|
||||
SWAP(GPUTexture *, sldata->irradiance_pool, sldata->irradiance_rt);
|
||||
/* Restore */
|
||||
|
|
|
@ -445,6 +445,7 @@ typedef struct EEVEE_LightProbesInfo {
|
|||
float lod_rt_max, lod_cube_max, lod_planar_max;
|
||||
float visibility_range;
|
||||
float visibility_blur;
|
||||
float intensity_fac;
|
||||
int shres;
|
||||
/* List of probes in the scene. */
|
||||
/* XXX This is fragile, can get out of sync quickly. */
|
||||
|
|
|
@ -3,6 +3,7 @@ uniform samplerCube probeHdr;
|
|||
uniform int probeSize;
|
||||
uniform float lodFactor;
|
||||
uniform float lodMax;
|
||||
uniform float intensityFac;
|
||||
|
||||
in vec3 worldPosition;
|
||||
|
||||
|
@ -192,6 +193,6 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
FragColor = irradiance_encode(out_radiance / weight);
|
||||
FragColor = irradiance_encode(intensityFac * out_radiance / weight);
|
||||
#endif
|
||||
}
|
|
@ -5,6 +5,7 @@ uniform float texelSize;
|
|||
uniform float lodFactor;
|
||||
uniform float lodMax;
|
||||
uniform float paddingSize;
|
||||
uniform float intensityFac;
|
||||
|
||||
in vec3 worldPosition;
|
||||
|
||||
|
@ -82,5 +83,5 @@ void main() {
|
|||
}
|
||||
}
|
||||
|
||||
FragColor = vec4(out_radiance / weight, 1.0);
|
||||
FragColor = vec4(intensityFac * out_radiance / weight, 1.0);
|
||||
}
|
|
@ -55,7 +55,9 @@ typedef struct LightProbe {
|
|||
float clipsta, clipend;
|
||||
|
||||
float vis_bias, vis_bleedbias; /* VSM visibility biases */
|
||||
float vis_blur, pad2;
|
||||
float vis_blur;
|
||||
|
||||
float intensity; /* Intensity multiplier */
|
||||
|
||||
int grid_resolution_x; /* Irradiance grid resolution */
|
||||
int grid_resolution_y;
|
||||
|
|
|
@ -179,6 +179,13 @@ static void rna_def_lightprobe(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibilty blur");
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
|
||||
|
||||
prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "intensity");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 3.0f, 1.0, 3);
|
||||
RNA_def_property_ui_text(prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
|
||||
|
||||
/* Data preview */
|
||||
prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_DATA);
|
||||
|
|
Loading…
Reference in New Issue