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:
authorDalai Felinto <dalai@blender.org>2021-10-05 16:37:19 +0300
committerDalai Felinto <dalai@blender.org>2021-10-05 16:38:09 +0300
commitb1e6e63c22249edfb501a7579efa22810ea55aee (patch)
tree4ad40ee968544626db5084f3b650ceaf243f21fb
parent55b8fc718a378423cd4b6d93258779e201877b1d (diff)
Cleanup: Geometry Nodes dashed lines
No functional change, just cleaning up the shader code a bit. Part of this is removing dead code (the discard was never called), and part is shuffling mix/max around based on feedback by Sybren Stüvel.
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl9
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
index 55d5d941290..402a07ad4e8 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
@@ -28,13 +28,10 @@ void main()
float t = ANTIALIAS / DASH_WIDTH;
float slope = 1.0 / (2.0 * t);
- float alpha = min(1.0, max(0.0, slope * (normalized_distance_triangle - dashFactor + t)));
+ float unclamped_alpha = 1.0 - slope * (normalized_distance_triangle - dashFactor + t);
+ float alpha = max(0.0, min(unclamped_alpha, 1.0));
- if (alpha < 0.0) {
- discard;
- }
-
- fragColor.a *= 1.0 - alpha;
+ fragColor.a *= alpha;
}
fragColor.a *= smoothstep(1.0, 0.1, abs(colorGradient));