Commit: e226460dd35b1439092888f280b00e7993d78f13 Author: Jeroen Bakker Date: Tue Mar 19 15:41:14 2019 +0100 Branches: master https://developer.blender.org/rBe226460dd35b1439092888f280b00e7993d78f13
Workbench: World Clipping For Specular Transparent When Specular Transparent materials are used the world clipping did not work on the transparent materials. The reason was that the accum shaders did not vary on the existance of the clipping planes This patch will variate the accum shaders when clipping planes are active. Reviewed By: fclem Maniphest Tasks: T61023 =================================================================== M source/blender/draw/engines/workbench/workbench_deferred.c M source/blender/draw/engines/workbench/workbench_forward.c M source/blender/draw/engines/workbench/workbench_materials.c M source/blender/draw/engines/workbench/workbench_private.h =================================================================== diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index b4175935b7a..1fe0202da5b 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -824,7 +824,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data( DRW_shgroup_stencil_mask(material->shgrp, (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF); DRW_shgroup_uniform_int(material->shgrp, "object_id", &material->object_id, 1); workbench_material_shgroup_uniform(wpd, material->shgrp, material, ob, true, true, interp); - if (wpd->world_clip_planes) { + if (WORLD_CLIPPING_ENABLED(wpd)) { const DRWContextState *draw_ctx = DRW_context_state_get(); RegionView3D *rv3d = draw_ctx->rv3d; DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp, rv3d); diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index d6a11a2b1e7..bf5de40bbef 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -199,7 +199,7 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data( } material->object_id = engine_object_data->object_id; DRW_shgroup_uniform_int(material->shgrp_object_outline, "object_id", &material->object_id, 1); - if (wpd->world_clip_planes) { + if (WORLD_CLIPPING_ENABLED(wpd)) { const DRWContextState *draw_ctx = DRW_context_state_get(); RegionView3D *rv3d = draw_ctx->rv3d; DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp_object_outline, rv3d); diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 47895f8729b..0bca8541e80 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -130,7 +130,7 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_text if (is_hair) { BLI_dynstr_appendf(ds, "#define HAIR_SHADER\n"); } - if (wpd->world_clip_planes != NULL) { + if (WORLD_CLIPPING_ENABLED(wpd)) { BLI_dynstr_appendf(ds, "#define USE_WORLD_CLIP_PLANES\n"); } @@ -192,7 +192,7 @@ int workbench_material_get_prepass_shader_index( SET_FLAG_FROM_TEST(index, NORMAL_VIEWPORT_PASS_ENABLED(wpd), 1 << 3); SET_FLAG_FROM_TEST(index, MATCAP_ENABLED(wpd), 1 << 4); SET_FLAG_FROM_TEST(index, use_textures, 1 << 5); - SET_FLAG_FROM_TEST(index, wpd->world_clip_planes != NULL, 1 << 6); + SET_FLAG_FROM_TEST(index, WORLD_CLIPPING_ENABLED(wpd), 1 << 6); BLI_assert(index < MAX_PREPASS_SHADERS); return index; } @@ -207,6 +207,7 @@ int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool u SET_FLAG_FROM_TEST(index, is_hair, 1 << 3); /* 1 bits SHADOWS (only facing factor) */ SET_FLAG_FROM_TEST(index, SHADOW_ENABLED(wpd), 1 << 4); + SET_FLAG_FROM_TEST(index, WORLD_CLIPPING_ENABLED(wpd), 1 << 5); BLI_assert(index < MAX_ACCUM_SHADERS); return index; } @@ -281,7 +282,7 @@ void workbench_material_shgroup_uniform( DRW_shgroup_uniform_float(grp, "materialRoughness", &material->roughness, 1); } - if (wpd->world_clip_planes != NULL) { + if (WORLD_CLIPPING_ENABLED(wpd)) { DRW_shgroup_uniform_vec4(grp, "WorldClipPlanes", wpd->world_clip_planes[0], 6); DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES); } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index eb1d9c4e860..9f13a1c9999 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -39,7 +39,7 @@ #define M_GOLDEN_RATION_CONJUGATE 0.618033988749895 #define MAX_COMPOSITE_SHADERS (1 << 6) #define MAX_PREPASS_SHADERS (1 << 7) -#define MAX_ACCUM_SHADERS (1 << 5) +#define MAX_ACCUM_SHADERS (1 << 6) #define MAX_CAVITY_SHADERS (1 << 3) #define TEXTURE_DRAWING_ENABLED(wpd) (wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR) @@ -71,6 +71,7 @@ #define NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd) (MATCAP_ENABLED(wpd) || STUDIOLIGHT_ENABLED(wpd) || SHADOW_ENABLED(wpd)) #define NORMAL_VIEWPORT_PASS_ENABLED(wpd) (NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd) || SSAO_ENABLED(wpd) || CURVATURE_ENABLED(wpd)) #define NORMAL_ENCODING_ENABLED() (true) +#define WORLD_CLIPPING_ENABLED(wpd) (wpd->world_clip_planes != NULL) struct RenderEngine; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs