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
8 changed files with 14 additions and 16 deletions
Showing only changes of commit da1540a641 - Show all commits

View File

@ -1573,7 +1573,7 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
col.separator()
if light.type in {'POINT', 'SPOT'}:
col.prop(light, "use_falloff", text="Use Soft Falloff")
col.prop(light, "use_soft_falloff")
col.prop(light, "shadow_soft_size", text="Radius")
elif light.type == 'SUN':
col.prop(light, "angle")

View File

@ -48,7 +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.use_falloff());
light->set_is_sphere(!b_point_light.use_soft_falloff());
break;
}
case BL::Light::type_SPOT: {
@ -57,7 +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.use_falloff());
light->set_is_sphere(!b_spot_light.use_soft_falloff());
break;
}
/* Hemi were removed from 2.8 */

View File

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

View File

@ -191,7 +191,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
if ((la->type == LA_AREA) && ELEM(la->area_shape, LA_AREA_DISK, LA_AREA_ELLIPSE)) {
evli->light_type = LAMPTYPE_AREA_ELLIPSE;
}
else if (la->mode & LA_USE_FALLOFF) {
else if (la->mode & LA_USE_SOFT_FALLOFF) {
if (la->type == LA_LOCAL) {
evli->light_type = LAMPTYPE_OMNI_DISK;
}

View File

@ -78,7 +78,7 @@ void Light::sync(ShadowModule &shadows, const Object *ob, float threshold)
this->power[LIGHT_SPECULAR] = la->spec_fac * shape_power;
this->power[LIGHT_VOLUME] = la->volume_fac * point_power;
eLightType new_type = to_light_type(la->type, la->area_shape, la->mode & LA_USE_FALLOFF);
eLightType new_type = to_light_type(la->type, la->area_shape, la->mode & LA_USE_SOFT_FALLOFF);
if (assign_if_different(this->type, new_type)) {
shadow_discard_safe(shadows);
}

View File

@ -24,7 +24,7 @@
.energy_deprecated = 10.0f, \
.spotsize = DEG2RADF(45.0f), \
.spotblend = 0.15f, \
.mode = LA_SHADOW, \
.mode = LA_SHADOW | LA_USE_SOFT_FALLOFF, \
.clipsta = 0.05f, \
.clipend = 40.0f, \
.bias = 1.0f, \

View File

@ -139,7 +139,7 @@ enum {
// LA_SHOW_SHADOW_BOX = 1 << 18,
LA_SHAD_CONTACT = 1 << 19,
LA_CUSTOM_ATTENUATION = 1 << 20,
LA_USE_FALLOFF = 1 << 21,
LA_USE_SOFT_FALLOFF = 1 << 21,
};
/** #Light::falloff_type */

View File

@ -347,13 +347,12 @@ static void rna_def_point_light(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
PropertyRNA *prop;
prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_USE_FALLOFF);
prop = RNA_def_property(srna, "use_soft_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_USE_SOFT_FALLOFF);
RNA_def_property_ui_text(
prop,
"Use Soft Falloff",
"Soft Falloff",
"Apply falloff to avoid sharp edges when the light geometry intersects with other objects");
RNA_def_property_boolean_default(prop, true);
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
rna_def_light_energy(srna, LA_LOCAL);
@ -453,13 +452,12 @@ static void rna_def_spot_light(BlenderRNA *brna)
"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, "use_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_USE_FALLOFF);
prop = RNA_def_property(srna, "use_soft_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_USE_SOFT_FALLOFF);
RNA_def_property_ui_text(
prop,
"Use Soft Falloff",
"Soft Falloff",
"Apply falloff to avoid sharp edges when the light geometry intersects with other objects");
RNA_def_property_boolean_default(prop, true);
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}