diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-11-04 20:13:57 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-11-04 20:13:57 +0300 |
commit | 7a8c8ec5e990765bab2e8db6b54ed4f0e80c2a2b (patch) | |
tree | 78274c9fb9f62f8fc64145ca4c4ad64daa1362b6 | |
parent | c937f9c4e76c04cc245775d39cd2684e65515863 (diff) | |
parent | fd110291a5f133042511dee3648c354fca141a43 (diff) |
Merge branch 'blender-v2.91-release'
4 files changed, 31 insertions, 15 deletions
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index 3d574fca2ff..fd12747e2fa 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -40,7 +40,7 @@ class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel): bl_label = "Freestyle" bl_options = {'DEFAULT_CLOSED'} bl_order = 10 - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} def draw_header(self, context): rd = context.scene.render @@ -113,7 +113,7 @@ class RENDER_MT_lineset_context_menu(Menu): class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel): bl_label = "Freestyle" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} def draw_header(self, context): view_layer = context.view_layer @@ -178,7 +178,7 @@ class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel): class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel): bl_label = "Freestyle Line Set" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} def draw_edge_type_buttons(self, box, lineset, edge_type): # property names @@ -277,7 +277,7 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Panel): bl_label = "Freestyle Line Style" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} def draw_modifier_box_header(self, box, modifier): row = box.row() @@ -833,7 +833,7 @@ class MaterialFreestyleButtonsPanel: class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel): bl_label = "Freestyle Line" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} def draw(self, context): layout = self.layout diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_output_material.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_output_material.glsl index 4cb00c15b78..14271f9d107 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_output_material.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_output_material.glsl @@ -1,5 +1,9 @@ -void node_output_material( - Closure surface, Closure volume, vec3 displacement, float alpha_threshold, out Closure result) +void node_output_material(Closure surface, + Closure volume, + vec3 displacement, + float alpha_threshold, + float shadow_threshold, + out Closure result) { #ifdef VOLUMETRICS result = volume; @@ -7,9 +11,9 @@ void node_output_material( result = surface; # if defined(USE_ALPHA_HASH) /* Alpha clip emulation. */ - if (alpha_threshold >= 0.0) { + if ((rayType != EEVEE_RAY_SHADOW) ? (alpha_threshold >= 0.0) : (shadow_threshold >= 0.0)) { float alpha = saturate(1.0 - avg(result.transmittance)); - result.transmittance = vec3(step(alpha, alpha_threshold)); + result.transmittance = vec3(step(alpha, max(alpha_threshold, shadow_threshold))); } # endif #endif diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index e8bef4a8a9e..ac47f434c3b 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -942,6 +942,7 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pos"); RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 1, 3); RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop"); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index 578262e9f17..fb0b6e7b263 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -45,18 +45,29 @@ static int node_shader_gpu_output_material(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - GPUNodeLink *outlink, *alpha_threshold_link; - + GPUNodeLink *outlink, *alpha_threshold_link, *shadow_threshold_link; Material *ma = GPU_material_get_material(mat); - if (ma && ma->blend_method == MA_BM_CLIP) { - alpha_threshold_link = GPU_uniform(&ma->alpha_threshold); + + static float no_alpha_threshold = -1.0f; + if (ma) { + alpha_threshold_link = GPU_uniform((ma->blend_method == MA_BM_CLIP) ? &ma->alpha_threshold : + &no_alpha_threshold); + shadow_threshold_link = GPU_uniform((ma->blend_shadow == MA_BS_CLIP) ? &ma->alpha_threshold : + &no_alpha_threshold); } else { - static float no_alpha_threshold = -1.0f; alpha_threshold_link = GPU_uniform(&no_alpha_threshold); + shadow_threshold_link = GPU_uniform(&no_alpha_threshold); } - GPU_stack_link(mat, node, "node_output_material", in, out, alpha_threshold_link, &outlink); + GPU_stack_link(mat, + node, + "node_output_material", + in, + out, + alpha_threshold_link, + shadow_threshold_link, + &outlink); GPU_material_output_link(mat, outlink); return true; |