diff --git a/scripts/startup/bl_ui/properties_data_lightprobe.py b/scripts/startup/bl_ui/properties_data_lightprobe.py index 60f71cab48f..117976a1bf6 100644 --- a/scripts/startup/bl_ui/properties_data_lightprobe.py +++ b/scripts/startup/bl_ui/properties_data_lightprobe.py @@ -145,8 +145,6 @@ class DATA_PT_lightprobe_eevee_next(DataButtonsPanel, Panel): col.prop(probe, "grid_capture_emission") elif probe.type == 'CUBEMAP': - col = layout.column() - col.prop(probe, "resolution") sub = layout.column(align=True) sub.prop(probe, "clip_start", text="Clipping Start") sub.prop(probe, "clip_end", text="End") diff --git a/scripts/startup/bl_ui/properties_render.py b/scripts/startup/bl_ui/properties_render.py index 74ef1792188..691a9414791 100644 --- a/scripts/startup/bl_ui/properties_render.py +++ b/scripts/startup/bl_ui/properties_render.py @@ -897,6 +897,7 @@ class RENDER_PT_eevee_next_indirect_lighting(RenderButtonsPanel, Panel): col.operator("object.lightprobe_cache_free", text="Delete Light Caches").subset = 'ALL' col.prop(props, "gi_irradiance_pool_size", text="Pool Size") + col.prop(props, "gi_cubemap_resolution", text="Probe Resolution") class RENDER_PT_eevee_indirect_lighting_display(RenderButtonsPanel, Panel): diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index bb71ebdde48..f1631ea36af 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -1160,12 +1160,6 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) } /* Set default bake resolution. */ - if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "int", "resolution")) { - LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) { - lightprobe->resolution = LIGHT_PROBE_RESOLUTION_1024; - } - } - if (!DNA_struct_member_exists(fd->filesdna, "World", "int", "probe_resolution")) { LISTBASE_FOREACH (World *, world, &bmain->worlds) { world->probe_resolution = LIGHT_PROBE_RESOLUTION_1024; diff --git a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc index c579e48ab1f..7d9e28ed70d 100644 --- a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc +++ b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.cc @@ -141,6 +141,25 @@ void ReflectionProbeModule::sync_world_lookdev() } } +eLightProbeResolution ReflectionProbeModule::reflection_probe_resolution() const +{ + switch (instance_.scene->eevee.gi_cubemap_resolution) { + case 64: + return LIGHT_PROBE_RESOLUTION_64; + case 128: + return LIGHT_PROBE_RESOLUTION_128; + case 256: + return LIGHT_PROBE_RESOLUTION_256; + case 512: + return LIGHT_PROBE_RESOLUTION_512; + case 1024: + return LIGHT_PROBE_RESOLUTION_1024; + default: + return LIGHT_PROBE_RESOLUTION_2048; + } + return LIGHT_PROBE_RESOLUTION_2048; +} + void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle) { const ::LightProbe *light_probe = (::LightProbe *)ob->data; @@ -148,8 +167,7 @@ void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle) return; } const bool is_dirty = ob_handle.recalc != 0; - int subdivision = layer_subdivision_for( - max_resolution_, static_cast(light_probe->resolution)); + int subdivision = layer_subdivision_for(max_resolution_, reflection_probe_resolution()); ReflectionProbe &probe = find_or_insert(ob_handle, subdivision); probe.do_render |= is_dirty; probe.is_probe_used = true; diff --git a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.hh b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.hh index a993a254835..0f266897bdb 100644 --- a/source/blender/draw/engines/eevee_next/eevee_reflection_probes.hh +++ b/source/blender/draw/engines/eevee_next/eevee_reflection_probes.hh @@ -163,6 +163,8 @@ class ReflectionProbeModule { bool has_only_world_probe() const; + eLightProbeResolution reflection_probe_resolution() const; + /* Capture View requires access to the cube-maps texture for frame-buffer configuration. */ friend class CaptureView; /* Instance requires access to #update_probes_this_sample_ */ diff --git a/source/blender/makesdna/DNA_lightprobe_defaults.h b/source/blender/makesdna/DNA_lightprobe_defaults.h index a89135e3fa2..26069455e48 100644 --- a/source/blender/makesdna/DNA_lightprobe_defaults.h +++ b/source/blender/makesdna/DNA_lightprobe_defaults.h @@ -42,7 +42,6 @@ .intensity = 1.0f, \ .flag = LIGHTPROBE_FLAG_SHOW_INFLUENCE, \ .grid_flag = LIGHTPROBE_GRID_CAPTURE_INDIRECT | LIGHTPROBE_GRID_CAPTURE_EMISSION, \ - .resolution = LIGHT_PROBE_RESOLUTION_1024, \ } /** \} */ diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h index dee169c594c..47ec1024468 100644 --- a/source/blender/makesdna/DNA_lightprobe_types.h +++ b/source/blender/makesdna/DNA_lightprobe_types.h @@ -67,7 +67,7 @@ typedef struct LightProbe { /** Irradiance grid: Dilation. */ float grid_dilation_threshold; float grid_dilation_radius; - char _pad1[4]; + /** Light intensity clamp. */ float grid_clamp_direct; float grid_clamp_indirect; @@ -75,26 +75,10 @@ typedef struct LightProbe { /** Surface element density for scene surface cache. In surfel per unit distance. */ float surfel_density; - /** - * Resolution of the cube light probe when baked to a texture. - * Contains `eLightProbeResolution`. - */ - int resolution; - /** Object visibility group, inclusive or exclusive. */ struct Collection *visibility_grp; } LightProbe; -/* LightProbe->resolution, World->probe_resolution. */ -typedef enum eLightProbeResolution { - LIGHT_PROBE_RESOLUTION_64 = 6, - LIGHT_PROBE_RESOLUTION_128 = 7, - LIGHT_PROBE_RESOLUTION_256 = 8, - LIGHT_PROBE_RESOLUTION_512 = 9, - LIGHT_PROBE_RESOLUTION_1024 = 10, - LIGHT_PROBE_RESOLUTION_2048 = 11, -} eLightProbeResolution; - /* Probe->type */ enum { LIGHTPROBE_TYPE_CUBE = 0, diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 6ac8a02d80e..0f0bc1bf7f6 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -116,3 +116,13 @@ enum { */ WO_DS_SHOW_TEXS = 1 << 2, }; + +/** #World::probe_resolution. */ +typedef enum eLightProbeResolution { + LIGHT_PROBE_RESOLUTION_64 = 6, + LIGHT_PROBE_RESOLUTION_128 = 7, + LIGHT_PROBE_RESOLUTION_256 = 8, + LIGHT_PROBE_RESOLUTION_512 = 9, + LIGHT_PROBE_RESOLUTION_1024 = 10, + LIGHT_PROBE_RESOLUTION_2048 = 11, +} eLightProbeResolution; diff --git a/source/blender/makesrna/intern/rna_lightprobe.cc b/source/blender/makesrna/intern/rna_lightprobe.cc index 1cc1a45fd93..009f90dc77c 100644 --- a/source/blender/makesrna/intern/rna_lightprobe.cc +++ b/source/blender/makesrna/intern/rna_lightprobe.cc @@ -57,16 +57,6 @@ static EnumPropertyItem lightprobe_type_items[] = { {0, nullptr, 0, nullptr, nullptr}, }; -static EnumPropertyItem lightprobe_resolution_items[] = { - {LIGHT_PROBE_RESOLUTION_64, "64", 0, "64", ""}, - {LIGHT_PROBE_RESOLUTION_128, "128", 0, "128", ""}, - {LIGHT_PROBE_RESOLUTION_256, "256", 0, "256", ""}, - {LIGHT_PROBE_RESOLUTION_512, "512", 0, "512", ""}, - {LIGHT_PROBE_RESOLUTION_1024, "1024", 0, "1024", ""}, - {LIGHT_PROBE_RESOLUTION_2048, "2048", 0, "2048", ""}, - {0, nullptr, 0, nullptr, nullptr}, -}; - static void rna_def_lightprobe(BlenderRNA *brna) { StructRNA *srna; @@ -296,12 +286,6 @@ static void rna_def_lightprobe(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibility blur"); RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc"); - prop = RNA_def_property(srna, "resolution", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, nullptr, "resolution"); - RNA_def_property_enum_items(prop, lightprobe_resolution_items); - RNA_def_property_ui_text(prop, "Resolution", "Resolution when baked to a texture"); - 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, nullptr, "intensity"); RNA_def_property_range(prop, 0.0f, FLT_MAX);