Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-06-10 16:30:49 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-06-10 21:06:26 +0300
commit95894421cb4e9ccabb4cff393b561625b9bc4280 (patch)
treedb343a83b911d7fe2ca2f1d4d7c9814598e19530 /source/blender/draw/intern/draw_manager_exec.c
parentb23d5132a90a0e8360a20199c8e7bb45174987c4 (diff)
Workbench: Xray: Optimize and fix implementation.
There was a method explained in the Weighted Blended Order-Independent Transparency paper to support hardware that does not support per render target blending function. So now only 2 geometry passes are required instead of 3 (one being the outline/depth fill pass). This also fix how the blending is done. There was some premult confusion in the implementation.
Diffstat (limited to 'source/blender/draw/intern/draw_manager_exec.c')
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index f6b6438395d..3b7d19ac361 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -222,7 +222,7 @@ void drw_state_set(DRWState state)
if (CHANGED_ANY_STORE_VAR(
DRW_STATE_BLEND | DRW_STATE_BLEND_PREMUL | DRW_STATE_ADDITIVE |
DRW_STATE_MULTIPLY | DRW_STATE_TRANSMISSION | DRW_STATE_ADDITIVE_FULL |
- DRW_STATE_TRANSPARENT_REVEALAGE,
+ DRW_STATE_BLEND_OIT,
test))
{
if (test) {
@@ -241,8 +241,9 @@ void drw_state_set(DRWState state)
else if ((state & DRW_STATE_TRANSMISSION) != 0) {
glBlendFunc(GL_ONE, GL_SRC_ALPHA);
}
- else if ((state & DRW_STATE_TRANSPARENT_REVEALAGE) != 0) {
- glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
+ else if ((state & DRW_STATE_BLEND_OIT) != 0) {
+ glBlendFuncSeparate(GL_ONE, GL_ONE, /* RGB */
+ GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); /* Alpha */
}
else if ((state & DRW_STATE_ADDITIVE) != 0) {
/* Do not let alpha accumulate but premult the source RGB by it. */