Eevee: Shadows: Add UI buttons for size and method

Only one method is available right now. VSM and PCF are comming.
This commit is contained in:
Clément Foucault 2017-09-01 15:59:58 +02:00
parent 8b7a83a868
commit e2603a6e82
3 changed files with 78 additions and 0 deletions

View File

@ -746,6 +746,25 @@ class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
col.prop(props, "ssr_firefly_fac")
class RENDER_PT_eevee_shadows(RenderButtonsPanel, Panel):
bl_label = "Shadows"
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
scene = context.scene
return scene and (scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
props = scene.layer_properties['BLENDER_EEVEE']
col = layout.column()
col.prop(props, "shadow_method")
col.prop(props, "shadow_size")
classes = (
RENDER_MT_presets,
RENDER_MT_ffmpeg_presets,
@ -767,6 +786,7 @@ classes = (
RENDER_PT_eevee_screen_space_reflections,
RENDER_PT_eevee_poststack_settings,
RENDER_PT_eevee_postprocess_settings,
RENDER_PT_eevee_shadows,
)
if __name__ == "__main__": # only for live edit.

View File

@ -290,6 +290,27 @@ class RENDERLAYER_PT_eevee_screen_space_reflections(RenderLayerButtonsPanel, Pan
col.template_override_property(layer_props, scene_props, "ssr_firefly_fac")
class RENDERLAYER_PT_eevee_shadows(RenderLayerButtonsPanel, Panel):
bl_label = "Shadows"
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
scene = context.scene
return scene and (scene.render.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.render_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "shadow_method")
col.template_override_property(layer_props, scene_props, "shadow_size")
classes = (
RENDERLAYER_UL_renderlayers,
RENDERLAYER_PT_layers,

View File

@ -2658,6 +2658,8 @@ RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_max_roughness)
RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_thickness)
RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_border_fade)
RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(ssr_firefly_fac)
RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_method)
RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(shadow_size)
/* object engine */
RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire)
@ -6205,6 +6207,26 @@ static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
/* Keep in sync with eevee_private.h */
static EnumPropertyItem eevee_shadow_method_items[] = {
{1, "ESM", 0, "ESM", "Exponential Shadow Mapping"},
/* TODO */
// {2, "VSM", 0, "VSM", "Variance Shadow Mapping"},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem eevee_shadow_size_items[] = {
{64, "64", 0, "64px", ""},
{128, "128", 0, "128px", ""},
{256, "256", 0, "256px", ""},
{512, "512", 0, "512px", ""},
{1024, "1024", 0, "1024px", ""},
{2048, "2048", 0, "2048px", ""},
{4096, "4096", 0, "4096px", ""},
{8192, "8192", 0, "8192px", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "SceneLayerEngineSettingsEevee", "SceneLayerSettings");
RNA_def_struct_ui_text(srna, "Eevee Scene Layer Settings", "Eevee Engine settings");
@ -6532,6 +6554,21 @@ static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update");
/* Shadows */
prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_method_get", "rna_LayerEngineSettings_Eevee_shadow_method_set", NULL);
RNA_def_property_enum_items(prop, eevee_shadow_method_items);
RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update");
prop = RNA_def_property(srna, "shadow_size", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Eevee_shadow_size_get", "rna_LayerEngineSettings_Eevee_shadow_size_set", NULL);
RNA_def_property_enum_items(prop, eevee_shadow_size_items);
RNA_def_property_ui_text(prop, "Size", "Size of every shadow maps");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_SceneLayerEngineSettings_update");
RNA_define_verify_sdna(1); /* not in sdna */
}