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.
This commit is contained in:
parent
55b8fc718a
commit
b1e6e63c22
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue