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:46:10 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-06-10 21:06:26 +0300
commit15862e199087dec07b784d9af7aa23cdbbdcaff2 (patch)
tree0c515813e22d1c33bf433e9f4c32d6046ad05609 /source/blender/draw/engines
parent95894421cb4e9ccabb4cff393b561625b9bc4280 (diff)
Workbench: Xray: Lower hairs opacity
Since hairs are very likely to owerflow the weight buffer, we divide their alpha value by 3. This might become a particle system setting if needed.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 8d67a936382..fb949cd02c9 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -420,7 +420,10 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
workbench_material_set_normal_world_matrix(shgrp, wpd, e_data.normal_world_matrix);
DRW_shgroup_uniform_block(shgrp, "world_block", wpd->world_ubo);
DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
- DRW_shgroup_uniform_float(shgrp, "alpha", &wpd->shading.xray_alpha, 1);
+ /* Hairs have lots of layer and can rapidly become the most prominent surface.
+ * So lower their alpha artificially. */
+ float hair_alpha = wpd->shading.xray_alpha * 0.33f;
+ DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
if (image) {
GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, false, false);
DRW_shgroup_uniform_texture(shgrp, "image", tex);