-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshimmering.yaml
More file actions
74 lines (72 loc) · 2.77 KB
/
shimmering.yaml
File metadata and controls
74 lines (72 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import:
- ../tiling/simplex.yaml
- ../generative/noise.yaml
- ../space/constant.yaml
styles:
polygons-shimmering:
doc:
author:
name: Patricio Gonzalez Vivo
twitter: patriciogv
version: 0.0.1
tangram-version: 0.0.7
licence: MIT
description: |
Apply a shimmering radom pattern of simplex grid triangles to the polygon style. To learn more about noise and simplex grid check [this chapter from the Book of Shaders](https://thebookofshaders.com/11/)
ui:
shaders:
defines:
SHIMMERING_SCALE:
type: number
label: Scale
range:
min: 1.
max: 1000.
step: 1.
SHIMMERING_SPEED:
type: number
label: Speed
range:
min: 0.
max: 1.
step: 0.01
SHIMMERING_AMOUNT:
type: number
label: Amount
range:
min: 0.
max: 1.
step: 0.01
SHIMMERING_COLOR:
type: color
label: Color
SHIMMERING_BACKGROUND_COLOR:
type: color
label: 'Background color'
SHIMMERING_ANIMATED:
type: boolean
label: Animate
base: polygons
mix: [tiling-simplex, generative-noise, space-constant]
animated: true
shaders:
defines:
SHIMMERING_SCALE: 10.
SHIMMERING_COLOR: color.rgb
SHIMMERING_BACKGROUND_COLOR: color.rgb*.5
SHIMMERING_SPEED: 0.1
SHIMMERING_AMOUNT: 1.
SHIMMERING_ANIMATED: true
blocks:
color: |
vec2 st = getConstantCoords()*SHIMMERING_SCALE;
vec2 s = skew(st);
vec2 s_f = fract(s);
#ifdef SHIMMERING_ANIMATED
float n = snoise(vec3(floor(s+step(s_f.x,s_f.y)*5.),u_time*SHIMMERING_SPEED));
#else
float n = snoise(floor(s+step(s_f.x,s_f.y)*5.));
#endif
color.rgb = mix(SHIMMERING_COLOR,
mix(SHIMMERING_BACKGROUND_COLOR,SHIMMERING_COLOR,n),
SHIMMERING_AMOUNT);