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:
authorJeroen Bakker <j.bakker@atmind.nl>2018-06-15 18:40:18 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-06-15 18:42:11 +0300
commit9c629b06bfdf645c009d953902c936b82900053a (patch)
treea2e30c03b9d98ac0373263b6b927314a5a31ca75
parent3e4bf31327c9264c735b85e565d817016db495fc (diff)
Workbench OpenGL render: always render alpha on 1.0
Old implementation rendered alpha to 0.0 for background, but only during deferred rendering. We should attach this to an DNA setting and also let the forward shading respect this. But for now this is a better default
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl3
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl6
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c1
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h3
4 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
index f67d2ff6745..069cb0f52d8 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
@@ -17,7 +17,8 @@ struct WorldData {
LightData lights[3];
int num_lights;
int matcap_orientation;
- int pad[2];
+ float background_alpha;
+ int pad[1];
};
struct MaterialData {
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl
index 461fb2fb130..4a1d88c29c1 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl
@@ -32,7 +32,7 @@ void main()
#ifndef V3D_SHADING_OBJECT_OUTLINE
if (object_id == NO_OBJECT_ID) {
- fragColor = vec4(background_color(world_data, uv_viewport.y), 0.0);
+ fragColor = vec4(background_color(world_data, uv_viewport.y), world_data.background_alpha);
return;
}
#else /* !V3D_SHADING_OBJECT_OUTLINE */
@@ -41,10 +41,10 @@ void main()
if (object_id == NO_OBJECT_ID) {
vec3 background = background_color(world_data, uv_viewport.y);
if (object_outline == 0.0) {
- fragColor = vec4(background, 0.0);
+ fragColor = vec4(background, world_data.background_alpha);
}
else {
- fragColor = vec4(mix(world_data.object_outline_color.rgb, background, object_outline), 1.0-object_outline);
+ fragColor = vec4(mix(world_data.object_outline_color.rgb, background, object_outline), clamp(world_data.background_alpha, 1.0, object_outline));
}
return;
}
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index df0a2bf4684..72d59068e03 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -36,6 +36,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
WORKBENCH_UBO_World *wd = &wpd->world_data;
wd->matcap_orientation = (wpd->shading.flag & V3D_SHADING_MATCAP_FLIP_X) > 0;
+ wd->background_alpha = 1.0f;
if ((v3d->flag3 & V3D_SHOW_WORLD) &&
(scene->world != NULL))
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 5e8a7c05161..7a74deed357 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -124,7 +124,8 @@ typedef struct WORKBENCH_UBO_World {
WORKBENCH_UBO_Light lights[3];
int num_lights;
int matcap_orientation;
- int pad[2];
+ float background_alpha;
+ int pad[1];
} WORKBENCH_UBO_World;
BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_World, 16)