EEVEE-Next: Rework the material panel
- Adds the missing new RNA definitions - Split settings panel into surface and volume - Expose displacement and volume nodetree panels - Rename `Cull Backfaces` to `Backface Culling` for consistency - Rename `use_backface_culling_probe` to `lightprobe_volume_single_sided` for accuracy and avoiding confusion as it is not a real backface culling. - Rename `Screen Space Refraction` to `Raytrace Refraction` for accuracy. Motivation is to make it closer to cycles now that EEVEE is compatible with more features. Pull Request: https://projects.blender.org/blender/blender/pulls/113971
This commit is contained in:
committed by
Clément Foucault
parent
b262655d39
commit
7b97bc48d8
@@ -183,7 +183,7 @@ class EEVEE_MATERIAL_PT_volume(MaterialButtonsPanel, Panel):
|
|||||||
bl_translation_context = i18n_contexts.id_id
|
bl_translation_context = i18n_contexts.id_id
|
||||||
bl_context = "material"
|
bl_context = "material"
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
COMPAT_ENGINES = {'BLENDER_EEVEE'}
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT'}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@@ -201,6 +201,29 @@ class EEVEE_MATERIAL_PT_volume(MaterialButtonsPanel, Panel):
|
|||||||
panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL', "Volume")
|
panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL', "Volume")
|
||||||
|
|
||||||
|
|
||||||
|
class EEVEE_MATERIAL_PT_displacement(MaterialButtonsPanel, Panel):
|
||||||
|
bl_label = "Displacement"
|
||||||
|
bl_translation_context = i18n_contexts.id_id
|
||||||
|
bl_context = "material"
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT'}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
engine = context.engine
|
||||||
|
mat = context.material
|
||||||
|
return mat and mat.use_nodes and (engine in cls.COMPAT_ENGINES) and not mat.grease_pencil
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
layout.use_property_split = True
|
||||||
|
|
||||||
|
mat = context.material
|
||||||
|
|
||||||
|
panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL', "Displacement")
|
||||||
|
|
||||||
|
|
||||||
def draw_material_settings(self, context):
|
def draw_material_settings(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
@@ -256,26 +279,54 @@ class EEVEE_NEXT_MATERIAL_PT_settings(MaterialButtonsPanel, Panel):
|
|||||||
|
|
||||||
mat = context.material
|
mat = context.material
|
||||||
|
|
||||||
col = layout.column(heading="Cull Backfaces")
|
layout.prop(mat, "pass_index")
|
||||||
|
|
||||||
|
|
||||||
|
class EEVEE_NEXT_MATERIAL_PT_settings_surface(MaterialButtonsPanel, Panel):
|
||||||
|
bl_label = "Surface"
|
||||||
|
bl_context = "material"
|
||||||
|
bl_parent_id = "EEVEE_NEXT_MATERIAL_PT_settings"
|
||||||
|
COMPAT_ENGINES = {'BLENDER_EEVEE_NEXT'}
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
layout.use_property_decorate = False
|
||||||
|
|
||||||
|
mat = context.material
|
||||||
|
|
||||||
|
col = layout.column(heading="Backface Culling")
|
||||||
col.prop(mat, "use_backface_culling", text="Camera")
|
col.prop(mat, "use_backface_culling", text="Camera")
|
||||||
col.prop(mat, "use_backface_culling_shadow", text="Shadow")
|
col.prop(mat, "use_backface_culling_shadow", text="Shadow")
|
||||||
col.prop(mat, "use_backface_culling_probe", text="Probe Capture")
|
|
||||||
|
|
||||||
layout.separator()
|
#TODO(fclem): Displacement option
|
||||||
|
#TODO(fclem): Transparent shadow option
|
||||||
|
|
||||||
layout.prop(mat, "blend_method")
|
col = layout.column()
|
||||||
layout.prop(mat, "shadow_method")
|
col.prop(mat, "surface_render_method", text="Render Method")
|
||||||
|
if mat.surface_render_method == 'BLENDED':
|
||||||
|
col.prop(mat, "show_transparent_back", text="Transparency Overlap")
|
||||||
|
elif mat.surface_render_method == 'DITHERED':
|
||||||
|
col.prop(mat, "use_screen_refraction", text="Raytraced Refraction")
|
||||||
|
|
||||||
row = layout.row()
|
col = layout.column(heading="Light Probe Volume")
|
||||||
row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method == 'CLIP'))
|
col.prop(mat, "lightprobe_volume_single_sided", text="Single Sided")
|
||||||
row.prop(mat, "alpha_threshold")
|
|
||||||
|
|
||||||
if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
|
|
||||||
layout.prop(mat, "show_transparent_back")
|
|
||||||
|
|
||||||
layout.prop(mat, "use_screen_refraction")
|
class EEVEE_NEXT_MATERIAL_PT_settings_volume(MaterialButtonsPanel, Panel):
|
||||||
layout.prop(mat, "volume_intersection_method")
|
bl_label = "Volume"
|
||||||
layout.prop(mat, "pass_index")
|
bl_context = "material"
|
||||||
|
bl_parent_id = "EEVEE_NEXT_MATERIAL_PT_settings"
|
||||||
|
COMPAT_ENGINES = {'BLENDER_EEVEE_NEXT'}
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
layout.use_property_decorate = False
|
||||||
|
|
||||||
|
mat = context.material
|
||||||
|
|
||||||
|
layout.prop(mat, "volume_intersection_method", text="Intersection")
|
||||||
|
|
||||||
|
|
||||||
class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel):
|
class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel):
|
||||||
@@ -345,8 +396,11 @@ classes = (
|
|||||||
EEVEE_MATERIAL_PT_context_material,
|
EEVEE_MATERIAL_PT_context_material,
|
||||||
EEVEE_MATERIAL_PT_surface,
|
EEVEE_MATERIAL_PT_surface,
|
||||||
EEVEE_MATERIAL_PT_volume,
|
EEVEE_MATERIAL_PT_volume,
|
||||||
|
EEVEE_MATERIAL_PT_displacement,
|
||||||
EEVEE_MATERIAL_PT_settings,
|
EEVEE_MATERIAL_PT_settings,
|
||||||
EEVEE_NEXT_MATERIAL_PT_settings,
|
EEVEE_NEXT_MATERIAL_PT_settings,
|
||||||
|
EEVEE_NEXT_MATERIAL_PT_settings_surface,
|
||||||
|
EEVEE_NEXT_MATERIAL_PT_settings_volume,
|
||||||
MATERIAL_PT_lineart,
|
MATERIAL_PT_lineart,
|
||||||
MATERIAL_PT_viewport,
|
MATERIAL_PT_viewport,
|
||||||
EEVEE_MATERIAL_PT_viewport_settings,
|
EEVEE_MATERIAL_PT_viewport_settings,
|
||||||
|
|||||||
@@ -1301,7 +1301,7 @@ PassMain::Sub *CapturePipeline::surface_material_add(::Material *blender_mat, GP
|
|||||||
GPUPass *gpupass = GPU_material_get_pass(gpumat);
|
GPUPass *gpupass = GPU_material_get_pass(gpumat);
|
||||||
sub_pass.shader_set(GPU_pass_shader_get(gpupass));
|
sub_pass.shader_set(GPU_pass_shader_get(gpupass));
|
||||||
sub_pass.push_constant("is_double_sided",
|
sub_pass.push_constant("is_double_sided",
|
||||||
!(blender_mat->blend_flag & MA_BL_CULL_BACKFACE_PROBE));
|
!(blender_mat->blend_flag & MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED));
|
||||||
return &sub_pass;
|
return &sub_pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ typedef struct Material {
|
|||||||
/* Transparency. */
|
/* Transparency. */
|
||||||
float alpha_threshold;
|
float alpha_threshold;
|
||||||
float refract_depth;
|
float refract_depth;
|
||||||
char blend_method;
|
char blend_method; /* TODO(fclem): Deprecate once we remove legacy EEVEE. */
|
||||||
char blend_shadow;
|
char blend_shadow; /* TODO(fclem): Deprecate once we remove legacy EEVEE. */
|
||||||
char blend_flag;
|
char blend_flag;
|
||||||
|
|
||||||
/* Volume. */
|
/* Volume. */
|
||||||
@@ -358,7 +358,7 @@ enum {
|
|||||||
MA_BL_SS_REFRACTION = (1 << 1),
|
MA_BL_SS_REFRACTION = (1 << 1),
|
||||||
MA_BL_CULL_BACKFACE = (1 << 2),
|
MA_BL_CULL_BACKFACE = (1 << 2),
|
||||||
MA_BL_TRANSLUCENCY = (1 << 3),
|
MA_BL_TRANSLUCENCY = (1 << 3),
|
||||||
MA_BL_CULL_BACKFACE_PROBE = (1 << 4),
|
MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED = (1 << 4),
|
||||||
MA_BL_CULL_BACKFACE_SHADOW = (1 << 5),
|
MA_BL_CULL_BACKFACE_SHADOW = (1 << 5),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -793,10 +793,12 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
0,
|
0,
|
||||||
"Accurate",
|
"Accurate",
|
||||||
"Faces are considered as medium interface only when they have different consecutive "
|
"Faces are considered as medium interface only when they have different consecutive "
|
||||||
"facing. Gives correct results as long as the max ray depth is not exceeded"},
|
"facing. Gives correct results as long as the max ray depth is not exceeded. Have "
|
||||||
|
"significant memory overhead compared to the fast method"},
|
||||||
{0, nullptr, 0, nullptr, nullptr},
|
{0, nullptr, 0, nullptr, nullptr},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# if 1 /* Delete this section once we remove old eevee. */
|
||||||
static EnumPropertyItem prop_eevee_blend_items[] = {
|
static EnumPropertyItem prop_eevee_blend_items[] = {
|
||||||
{MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
|
{MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
|
||||||
{MA_BM_CLIP,
|
{MA_BM_CLIP,
|
||||||
@@ -832,6 +834,23 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
"Use noise to dither the binary visibility and use filtering to reduce the noise"},
|
"Use noise to dither the binary visibility and use filtering to reduce the noise"},
|
||||||
{0, nullptr, 0, nullptr, nullptr},
|
{0, nullptr, 0, nullptr, nullptr},
|
||||||
};
|
};
|
||||||
|
# endif
|
||||||
|
|
||||||
|
static EnumPropertyItem prop_eevee_surface_render_method_items[] = {
|
||||||
|
{MA_SURFACE_METHOD_DEFERRED,
|
||||||
|
"DITHERED",
|
||||||
|
0,
|
||||||
|
"Dithered",
|
||||||
|
"Allows for grayscale hashed transparency, and compatible with render passes and "
|
||||||
|
"raytracing. Also known as deferred rendering"},
|
||||||
|
{MA_SURFACE_METHOD_FORWARD,
|
||||||
|
"BLENDED",
|
||||||
|
0,
|
||||||
|
"Blended",
|
||||||
|
"Allows for colored transparency, but incompatible with render passes and raytracing. Also "
|
||||||
|
"known as forward rendering"},
|
||||||
|
{0, nullptr, 0, nullptr, nullptr},
|
||||||
|
};
|
||||||
|
|
||||||
srna = RNA_def_struct(brna, "Material", "ID");
|
srna = RNA_def_struct(brna, "Material", "ID");
|
||||||
RNA_def_struct_ui_text(
|
RNA_def_struct_ui_text(
|
||||||
@@ -840,6 +859,14 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
"Material data-block to define the appearance of geometric objects for rendering");
|
"Material data-block to define the appearance of geometric objects for rendering");
|
||||||
RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
|
RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "surface_render_method", PROP_ENUM, PROP_NONE);
|
||||||
|
RNA_def_property_enum_items(prop, prop_eevee_surface_render_method_items);
|
||||||
|
RNA_def_property_ui_text(prop,
|
||||||
|
"Surface Render Method",
|
||||||
|
"Controls the blending and the compatibility with certain features");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
|
||||||
|
# if 1 /* Delete this section once we remove old eevee. */
|
||||||
/* Blending (only Eevee for now) */
|
/* Blending (only Eevee for now) */
|
||||||
prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
|
prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
|
||||||
RNA_def_property_enum_items(prop, prop_eevee_blend_items);
|
RNA_def_property_enum_items(prop, prop_eevee_blend_items);
|
||||||
@@ -859,7 +886,9 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
"Clip Threshold",
|
"Clip Threshold",
|
||||||
"A pixel is rendered only if its alpha value is above this threshold");
|
"A pixel is rendered only if its alpha value is above this threshold");
|
||||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* TODO(fclem): Should be renamed to use_transparency_overlap. */
|
||||||
prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
|
RNA_def_property_boolean_negative_sdna(prop, nullptr, "blend_flag", MA_BL_HIDE_BACKFACE);
|
||||||
RNA_def_property_ui_text(prop,
|
RNA_def_property_ui_text(prop,
|
||||||
@@ -876,21 +905,32 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
|
|
||||||
prop = RNA_def_property(srna, "use_backface_culling_shadow", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_backface_culling_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE_SHADOW);
|
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE_SHADOW);
|
||||||
RNA_def_property_ui_text(prop, "Shadow Backface Culling", "Use back faces for casting shadows");
|
|
||||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_backface_culling_probe", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_CULL_BACKFACE_PROBE);
|
|
||||||
RNA_def_property_ui_text(
|
RNA_def_property_ui_text(
|
||||||
prop, "Probe Capture Backface Culling", "Use back faces for probe captures");
|
prop, "Shadow Backface Culling", "Use back face culling when casting shadows");
|
||||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "lightprobe_volume_single_sided", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
RNA_def_property_boolean_negative_sdna(
|
||||||
|
prop, nullptr, "blend_flag", MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED);
|
||||||
|
RNA_def_property_ui_text(
|
||||||
|
prop,
|
||||||
|
"Light Probe Volume Single Sided",
|
||||||
|
"Consider material single sided for light probe volume capture. "
|
||||||
|
"Additionnaly helps rejecting probes inside the object to avoid light leaks");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
|
||||||
|
/* TODO(fclem): Should be renamed to use_raytraced_refraction. */
|
||||||
prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
|
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
|
||||||
RNA_def_property_ui_text(
|
RNA_def_property_ui_text(
|
||||||
prop, "Screen Space Refraction", "Use raytraced screen space refractions");
|
prop,
|
||||||
|
"Raytrace Refraction",
|
||||||
|
"Use raytracing to determine refracted color instead of using only light probes. "
|
||||||
|
"This prevents the surface from contributing to the lighting of surfaces not using this "
|
||||||
|
"setting");
|
||||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
|
||||||
|
# if 1 /* Delete this section once we remove old eevee. */
|
||||||
prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSLUCENCY);
|
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSLUCENCY);
|
||||||
RNA_def_property_ui_text(
|
RNA_def_property_ui_text(
|
||||||
@@ -905,6 +945,7 @@ void RNA_def_material(BlenderRNA *brna)
|
|||||||
"Approximate the thickness of the object to compute two refraction "
|
"Approximate the thickness of the object to compute two refraction "
|
||||||
"events (0 is disabled)");
|
"events (0 is disabled)");
|
||||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||||
|
# endif
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "volume_intersection_method", PROP_ENUM, PROP_NONE);
|
prop = RNA_def_property(srna, "volume_intersection_method", PROP_ENUM, PROP_NONE);
|
||||||
RNA_def_property_enum_items(prop, prop_eevee_volume_isect_method_items);
|
RNA_def_property_enum_items(prop, prop_eevee_volume_isect_method_items);
|
||||||
|
|||||||
Reference in New Issue
Block a user