Commit: 68b920d6a17ab5dc221e43b7bd3a9ca54d486004 Author: Jeroen Bakker Date: Thu Apr 26 17:18:03 2018 +0200 Branches: blender2.8-workbench https://developer.blender.org/rB68b920d6a17ab5dc221e43b7bd3a9ca54d486004
Workbench: Shadow primitives =================================================================== M source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl M source/blender/draw/engines/workbench/workbench_materials.c =================================================================== diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl index ac207aed4a3..a3bab32af67 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl @@ -1,16 +1,37 @@ layout(triangles) in; -layout(triangle_strip, max_vertices=3) out; +layout(triangle_strip, max_vertices=12) out; -uniform vec4 direction = vec4(0.57, 0.57, 0.0, 0.0); +uniform vec4 lightDirection = vec4(-4.0, -25.0, 0.0, 0.0); void main() { - for(int i = 0; i < gl_in.length(); i++) - { - vec4 new_pos = gl_in[i].gl_Position; + gl_Position = gl_in[0].gl_Position; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + EmitVertex(); + gl_Position = gl_in[0].gl_Position + lightDirection; + EmitVertex(); + gl_Position = gl_in[1].gl_Position + lightDirection; + EmitVertex(); + EndPrimitive(); - new_pos += direction; - gl_Position = new_pos; - EmitVertex(); - } + gl_Position = gl_in[1].gl_Position; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + EmitVertex(); + gl_Position = gl_in[1].gl_Position + lightDirection; + EmitVertex(); + gl_Position = gl_in[2].gl_Position + lightDirection; + EmitVertex(); + EndPrimitive(); + + gl_Position = gl_in[2].gl_Position; + EmitVertex(); + gl_Position = gl_in[0].gl_Position; + EmitVertex(); + gl_Position = gl_in[2].gl_Position + lightDirection; + EmitVertex(); + gl_Position = gl_in[0].gl_Position + lightDirection; + EmitVertex(); + EndPrimitive(); } \ No newline at end of file diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index dd44c393da3..a2c74e20b1c 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -303,7 +303,6 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata) wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), NULL); DRW_uniformbuffer_update(wpd->world_ubo, &wpd->world_data); - /* TODO: get from viewlayer collection engine */ psl->composite_pass = DRW_pass_create("Composite", DRW_STATE_WRITE_COLOR | DRW_STATE_STENCIL_EQUAL); grp = DRW_shgroup_create(wpd->composite_sh, psl->composite_pass); workbench_composite_uniforms(wpd, grp); @@ -312,7 +311,7 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata) DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); if (SHADOW_ENABLED(wpd)) { - psl->shadow_pass = DRW_pass_create("Shadow", DRW_STATE_WRITE_STENCIL); + psl->shadow_pass = DRW_pass_create("Shadow", DRW_STATE_DEPTH_LESS | DRW_STATE_WRITE_STENCIL); grp = DRW_shgroup_create(e_data.shadow_sh, psl->shadow_pass); DRW_shgroup_stencil_mask(grp, 0x01); wpd->shadow_shgrp = grp; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs