diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-19 14:31:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-20 20:14:22 +0300 |
commit | 687f09a8ad508b0f736b35337e589935296ecd0f (patch) | |
tree | 851b5c79017a8407c4a85f38a2ba5bd08771c9ff /source/blender/draw/engines/workbench/workbench_materials.c | |
parent | 883cb583550596e0c2e3b809ec8de059d0b053ad (diff) |
Workbench: Optimize Shadows.
This makes the shadows ~10 times faster in the general case.
This only create extrusion geometry on the outline edges. Also we increment
or decrement the stencil buffer by 2 for each manifold edge and only by 1
for non manifold. This make the algorithm robust yet less heavy than creating
one prism for each triangles.
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_materials.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_materials.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 1dcc8d0ec6d..944572729c1 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -620,10 +620,13 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob } if (SHADOW_ENABLED(wpd) && (ob->display.flag & OB_SHOW_SHADOW) > 0) { - struct Gwn_Batch *geom_shadow = DRW_cache_object_surface_get(ob); + struct Gwn_Batch *geom_shadow = DRW_cache_object_edge_detection_get(ob); if (geom_shadow) { if (is_sculpt_mode) { - DRW_shgroup_call_sculpt_add(wpd->shadow_shgrp, ob, ob->obmat); + /* Currently unsupported in sculpt mode. We could revert to the slow + * method in this case but i'm not sure if it's a good idea given that + * sculped meshes are heavy to begin with. */ + // DRW_shgroup_call_sculpt_add(wpd->shadow_shgrp, ob, ob->obmat); } else { DRW_shgroup_call_object_add(wpd->shadow_shgrp, geom_shadow, ob); |