Eevee: Add Lamp Specular multiplier.
It's usefull in some scenario to tweak the specular intensity of a light without modifying the diffuse contribution. Cycles allows it via lamps material which we currently not support in Eevee. This is a good workaround for now.
This commit is contained in:
@@ -143,7 +143,7 @@ class DATA_PT_EEVEE_lamp(DataButtonsPanel, Panel):
|
||||
sub.prop(lamp, "size_y", text="Size Y")
|
||||
|
||||
col = split.column()
|
||||
col.label()
|
||||
col.prop(lamp, "specular_factor", text="Specular")
|
||||
|
||||
|
||||
class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel):
|
||||
|
||||
@@ -1072,4 +1072,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "spec_fac")) {
|
||||
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
|
||||
la->spec_fac = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,6 +546,8 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
|
||||
/* Color */
|
||||
copy_v3_v3(evli->color, &la->r);
|
||||
|
||||
evli->spec = la->spec_fac;
|
||||
|
||||
/* Influence Radius */
|
||||
evli->dist = la->dist;
|
||||
|
||||
|
||||
@@ -200,11 +200,11 @@ void CLOSURE_NAME(
|
||||
#endif
|
||||
|
||||
#ifdef CLOSURE_GLOSSY
|
||||
out_spec += l_color_vis * light_specular(ld, N, view_vec, l_vector, roughnessSquared, f0) * occlu;
|
||||
out_spec += l_color_vis * light_specular(ld, N, view_vec, l_vector, roughnessSquared, f0) * occlu * ld.l_spec;
|
||||
#endif
|
||||
|
||||
#ifdef CLOSURE_CLEARCOAT
|
||||
out_spec += l_color_vis * light_specular(ld, C_N, view_vec, l_vector, C_roughnessSquared, f0) * C_intensity * occlu;
|
||||
out_spec += l_color_vis * light_specular(ld, C_N, view_vec, l_vector, C_roughnessSquared, f0) * C_intensity * occlu * ld.l_spec;
|
||||
#endif
|
||||
|
||||
#else /* HAIR_SHADER */
|
||||
@@ -218,11 +218,11 @@ void CLOSURE_NAME(
|
||||
#endif
|
||||
|
||||
#ifdef CLOSURE_GLOSSY
|
||||
out_spec += l_color_vis * light_specular(ld, N, V, l_vector, roughnessSquared, f0);
|
||||
out_spec += l_color_vis * light_specular(ld, N, V, l_vector, roughnessSquared, f0) * ld.l_spec;
|
||||
#endif
|
||||
|
||||
#ifdef CLOSURE_CLEARCOAT
|
||||
out_spec += l_color_vis * light_specular(ld, C_N, V, l_vector, C_roughnessSquared, f0) * C_intensity;
|
||||
out_spec += l_color_vis * light_specular(ld, C_N, V, l_vector, C_roughnessSquared, f0) * C_intensity * ld.l_spec;
|
||||
#endif
|
||||
|
||||
#endif /* HAIR_SHADER */
|
||||
|
||||
@@ -89,6 +89,8 @@ typedef struct Lamp {
|
||||
|
||||
float contact_dist, contact_bias, contact_spread, contact_thickness;
|
||||
|
||||
float spec_fac, pad;
|
||||
|
||||
/* preview */
|
||||
struct PreviewImage *preview;
|
||||
|
||||
|
||||
@@ -312,6 +312,13 @@ static void rna_def_lamp_shadow(StructRNA *srna, int sun)
|
||||
"in shadow maps");
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop = RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "spec_fac");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
|
||||
RNA_def_property_ui_text(prop, "Specular Factor", "Specular reflection multiplier");
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop = RNA_def_property(srna, "contact_shadow_distance", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "contact_dist");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
|
||||
Reference in New Issue
Block a user