We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b1e263 commit cb519a2Copy full SHA for cb519a2
common/src/main/resources/assets/lambda/shaders/fragment/renderer/rect_filled.frag
@@ -15,6 +15,14 @@ in float v_Shade;
15
out vec4 color;
16
17
#define SMOOTHING 0.25
18
+#define NOISE_GRANULARITY 0.005
19
+
20
+vec4 noise() {
21
+ // https://shader-tutorial.dev/advanced/color-banding-dithering/
22
+ float random = fract(sin(dot(v_TexCoord, vec2(12.9898, 78.233))) * 43758.5453);
23
+ float ofs = mix(-NOISE_GRANULARITY, NOISE_GRANULARITY, random);
24
+ return vec4(ofs, ofs, ofs, 0.0);
25
+}
26
27
vec4 shade() {
28
if (v_Shade != 1.0) return v_Color;
@@ -41,5 +49,5 @@ vec4 round() {
41
49
}
42
50
43
51
void main() {
44
- color = shade() * round();
52
+ color = shade() * round() + noise();
45
53
0 commit comments