From 5239198f177ad26e25e5f3608cd7e092065e2d8f Mon Sep 17 00:00:00 2001 From: YimingWu Date: Wed, 19 May 2021 15:07:19 +0800 Subject: [PATCH 1/2] Fix T88362: Lineart countour rendering error This is caused by lacking of consideration of OB_DUPLICOLLECTION in updateDepsgraph() in the modifier. Reviewed by: Antonio Vazquez (antoniov) https://developer.blender.org/D11292 --- .../intern/MOD_gpencillineart.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 080a3caa32f..c1a791d460b 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -194,6 +194,24 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams)) return isModifierDisabled(md); } +static void add_this_collection(Collection *c, + const ModifierUpdateDepsgraphContext *ctx, + const int mode) +{ + FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (c, ob, mode) { + if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) { + if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) { + DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); + DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); + } + } + if (ob->type == OB_EMPTY && (ob->transflag & OB_DUPLICOLLECTION)) { + add_this_collection(ob->instance_collection, ctx, mode); + } + } + FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END; +} + static void updateDepsgraph(GpencilModifierData *md, const ModifierUpdateDepsgraphContext *ctx, const int mode) @@ -208,15 +226,7 @@ static void updateDepsgraph(GpencilModifierData *md, ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); } else { - FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (ctx->scene->master_collection, ob, mode) { - if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) { - if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) { - DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); - DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); - } - } - } - FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END; + add_this_collection(ctx->scene->master_collection, ctx, mode); } DEG_add_object_relation( ctx->node, ctx->scene->camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); From a294670bacb1db66ca0aad29df5752b10b8ba7fd Mon Sep 17 00:00:00 2001 From: Mikhail Matrosov Date: Wed, 19 May 2021 12:09:29 +0200 Subject: [PATCH 2/2] EEVEE: Geometry info -> tangent: Make consistent with Cycles for hair Changes output for geometry info node in Eevee to be consistent with Cycles (w/o osl) Before this patch Eevee outputs Z-tangent even for hair. This patch changes it to output hair tangent (growth direction). Hair tangent is impossible to derive otherwise from normal or view direction. Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D10841 --- .../gpu/shaders/material/gpu_shader_material_geometry.glsl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl index 4db27c3049d..a14ff5021bf 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl @@ -37,8 +37,13 @@ void node_geometry(vec3 I, normal = (toworld * vec4(N, 0.0)).xyz; true_normal = normal; # endif + +# ifdef HAIR_SHADER + tangent = -hairTangent; +# else tangent_orco_z(orco, orco); node_tangent(N, orco, objmat, tangent); +# endif parametric = vec3(barycentric, 0.0); backfacing = (gl_FrontFacing) ? 0.0 : 1.0;