Lights: Option to use old point light falloff #117832

Merged
Brecht Van Lommel merged 14 commits from brecht/blender:point-sphere-light into blender-v4.1-release 2024-02-07 19:07:23 +01:00
5 changed files with 37 additions and 1 deletions
Showing only changes of commit 068a67a2d4 - Show all commits

View File

@ -1573,6 +1573,7 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
col.separator()
if light.type in {'POINT', 'SPOT'}:
col.prop(light, "shape", text="Shape")
col.prop(light, "shadow_soft_size", text="Radius")
elif light.type == 'SUN':
col.prop(light, "angle")
@ -1587,6 +1588,7 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
sub.prop(light, "size_y", text="Y")
if not (light.type == 'AREA' and clamp.is_portal):
col.separator()
sub = col.column()
sub.prop(clamp, "max_bounces")

View File

@ -48,6 +48,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
BL::PointLight b_point_light(b_light);
light->set_size(b_point_light.shadow_soft_size());
light->set_light_type(LIGHT_POINT);
light->set_is_sphere(b_point_light.shape() == BL::PointLight::shape_SPHERE);
break;
}
case BL::Light::type_SPOT: {
@ -56,6 +57,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
light->set_light_type(LIGHT_SPOT);
light->set_spot_angle(b_spot_light.spot_size());
light->set_spot_smooth(b_spot_light.spot_blend());
light->set_is_sphere(b_spot_light.shape() == BL::SpotLight::shape_SPHERE);
break;
}
/* Hemi were removed from 2.8 */

View File

@ -98,6 +98,7 @@ class DATA_PT_EEVEE_light(DataButtonsPanel, Panel):
col.separator()
if light.type in {'POINT', 'SPOT'}:
col.prop(light, "shape", text="Shape")
col.prop(light, "shadow_soft_size", text="Radius")
elif light.type == 'SUN':
col.prop(light, "angle")

View File

@ -39,6 +39,8 @@ typedef struct Light {
float radius;
/* Spot Light. */
short spot_shape;
short _pad3;
float spotsize;
float spotblend;
@ -77,7 +79,6 @@ typedef struct Light {
float spec_fac, att_dist;
float shadow_softness_factor;
float shadow_trace_distance;
float _pad3;
/* Preview */
struct PreviewImage *preview;
@ -160,3 +161,9 @@ enum {
LA_AREA_DISK = 4,
LA_AREA_ELLIPSE = 5,
};
/** #Light::spot_shape */
enum {
LA_SPOT_SPHERE = 0,
LA_SPOT_DISK = 1,
};

View File

@ -337,6 +337,17 @@ static void rna_def_light_shadow(StructRNA *srna, bool sun)
}
}
const EnumPropertyItem prop_spotshape_items[] = {
{LA_SPOT_SPHERE, "SPHERE", 0, "Sphere", "Emits light from a double-sided sphere geometry"},
{LA_SPOT_DISK,
"DISK",
0,
"Aligned Disk",
"The light appears to be a disk pointing towards the shading point. This shape is not "
"physically feasible, but gives softer shadows compared to sphere light"},
{0, nullptr, 0, nullptr, nullptr},
};
static void rna_def_point_light(BlenderRNA *brna)
{
StructRNA *srna;
@ -346,6 +357,13 @@ static void rna_def_point_light(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Point Light", "Omnidirectional point Light");
RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
PropertyRNA *prop;
prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "spot_shape");
RNA_def_property_enum_items(prop, prop_spotshape_items);
RNA_def_property_ui_text(prop, "Shape", "Sphere or aligned disk");
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
rna_def_light_energy(srna, LA_LOCAL);
rna_def_light_shadow(srna, false);
}
@ -442,6 +460,12 @@ static void rna_def_spot_light(BlenderRNA *brna)
"Show Cone",
"Display transparent cone in 3D view to visualize which objects are contained in it");
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "spot_shape");
RNA_def_property_enum_items(prop, prop_spotshape_items);
RNA_def_property_ui_text(prop, "Shape", "Sphere or aligned disk");
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}
static void rna_def_sun_light(BlenderRNA *brna)