Repository navigation
Expand file tree
/
Copy pathmouton.vert
More file actions
369 lines (311 loc) · 12 KB
/
Copy pathmouton.vert
File metadata and controls
369 lines (311 loc) · 12 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
#version 150
in vec4 a_position;
out vec3 animationAmp; //(x = walking, y = head, z = tail)
out vec3 animationSpeed; //(x = walking, y = head, z = tail)
out vec3 sheepPos;
out vec3 flowerPos;
out vec3 panelPos;
out vec3 panelWarningPos;
out vec3 anvilPos;
out vec3 sunDir;
out vec3 camPos;
out vec3 camTa;
out vec3 eyeDir;
out vec2 headRot;
out vec2 excited;
out float blink;
out float camFocal;
out float eyesSurprise;
out float fishEyeFactor;
out float noseSize;
uniform float iTime;
const float INFINITE = 9e7;
void main(void)
{
gl_Position = a_position;
float time = iTime;
// Default stuff
sheepPos = vec3(0.);
panelPos = vec3(INFINITE);
flowerPos = vec3(INFINITE);
panelWarningPos = vec3(INFINITE);
anvilPos = vec3(INFINITE);
camFocal = 2.;
blink = max(fract(iTime*.333), fract(iTime*.123+.1));
excited = vec2(0.);
sunDir = normalize(vec3(3.5,1.,-1.));
animationSpeed = vec3(1.,1.,1.);
fishEyeFactor = 0.;
headRot = vec2(0.);
noseSize = 1.;
eyesSurprise = 0.;
// Timeline
if (time < 7.5) // Head zoom
{
animationAmp = vec3(1.,.2, 1.); // Slow walk
animationSpeed = vec3(1.,1.,.5);
eyeDir = vec3(0.,.45,1.); // Tired
headRot.y = .25;
camFocal = 4.;
camPos = vec3(0.,2.5, -3.7);
camTa = vec3(0., 3., 0.);
} else if (time < 14.5) // Legs view
{
float time = time-7.5;
animationAmp = vec3(1.,.2, .25); // Slow walk
animationSpeed = vec3(1.,1.,2.);
eyeDir = vec3(0.,.5,1.); // Tired
headRot.y = .25;
camFocal = 4.;
camPos = vec3(5., .5, 0.);
camTa = vec3(0., .5, 1.);
} else if( time < 29.5) { // Desert walking
float time = time-14.5;
animationAmp = vec3(1.,.2, .25); // Slow walk
animationSpeed = vec3(1.,1.,2.);
eyeDir = vec3(0.,.5,1.); // Tired
headRot.y = .25;
camPos = vec3(5.+time*.5, 2., 0.+time*.5);
camTa = vec3(0., 2., 0.);
} else if( time < 44.) { // Day 'n night walking
float time = time-29.;
animationAmp = vec3(1.,.2, .25); // Slow walk
animationSpeed = vec3(1.,1.,2.);
eyeDir = vec3(0.,.5,1.); // Tired
headRot.y = .25;
//float t = 1.-exp( -40.*pow(time/20.,10.) )*30.;
float t = time*.35+2.5;
sunDir = normalize(vec3(cos(t), sin(t),-.3)); // Day night cycle
camFocal = 1.5;
camPos = vec3(22., 2., time*0.6-10.);
camTa = vec3(0., 2., time*0.6-10.);
} else if (time < 52.) { // Eye focus
float time = time-44.;
float t = smoothstep(5.,5.5,time);
headRot.y = mix(.25, 0., t);
animationAmp = vec3(1.-t,.2*(1.-t), 1.); // Slow walk
animationSpeed = vec3(1.,1.,.5);
eyeDir = vec3(t*.3,.3-t*.3,1.);
eyesSurprise = smoothstep(7.4,7.6,time)*.2;
camFocal = 4.;
camPos = vec3(0.,3., -4.);
camTa = vec3(0., 3., 0.);
if (time > 3.)
blink = max(fract(iTime*.333), fract(iTime*.333+.08));
} else if (time < 54.8) { // Panel food!
float time = time-52.;
panelPos = vec3(-5.,0.,-8.);
sheepPos = vec3(INFINITE);
eyeDir = vec3(.3,.0,1.);
eyesSurprise = .2;
float transition = smoothstep(0.,.5,time);
camFocal = mix(4., 3., transition);
camPos = vec3(0.,3., -4.);
camTa = mix(vec3(0., 3., 0.), vec3(-5., 5., -9.), transition);
} else if (time < 60.) { // Excited!
float time = time-55.;
excited.x = smoothstep(0.,.5,time);
animationAmp = vec3(0.,0.,0.);
blink = 0.;
eyeDir = vec3(.3,0.,1.);
camPos = mix(vec3(0.,3.,-4.), vec3(0.,2.,-6.), excited.x);
camTa = vec3(0., 3., 0.);
camFocal = mix(4., 3., excited.x) + smoothstep(0.,5.,time);
} else if (time < 65.) { // Panel run
float time = time-60.;
eyeDir = vec3(0.,0.,1.);
sheepPos = vec3(0.,0.,-time*3.-2.);
panelPos = vec3(-5.,0.,-8.);
animationAmp = vec3(1.,1.,.5);
animationSpeed = vec3(3.,1.5,8.)*1.5;
camPos = vec3(16.,5.,9.);
camTa = vec3(3., 5., -2.-time);
camFocal = 3.;
} else if (time < 73.) // Head exciting search
{
float time = time-65.;
animationAmp = vec3(1.,1.,1.);
animationSpeed = vec3(3.,1.5,8.);
float x = mod(time,8.);
float lf = smoothstep(0.5,1.,x)*smoothstep(2.8,2.5,x) - smoothstep(4.,4.5,x)*smoothstep(5.8,5.5,x) + cos(iTime)*.2;
eyeDir = vec3(lf,cos(iTime*.5)*.1+.1,1.);
fishEyeFactor = .3;
camFocal = 2.5;
camPos = vec3(2.75,1., -5.25);
camTa = vec3(0., 2.3, 0.);
float t = mod(time, 2.);
noseSize += smoothstep(0.5,.6,t)*smoothstep(0.7,.6,t)*.3;
t = mod(time+.3, 3.);
noseSize += smoothstep(0.5,.6,t)*smoothstep(0.7,.6,t)*.3;
} else if (time < 76.) { // Eye focus
float time = time-73.;
float t = smoothstep(1.,3.,time);
animationAmp = vec3(0.,1.*(1.-t*.5), 1.); // Slow walk
animationSpeed = vec3(3.,1.5,6.);
eyeDir = vec3(t*.5,.3-t*.45,1.);
camFocal = 4.;
camPos = vec3(0.,3., -4.);
camTa = vec3(0., 3., 0.);
if (time > 3.)
blink = max(fract(iTime*.333), fract(iTime*.333+.08));
} else if (time < 81.25) { // Panel warning!
float time = time-76.;
panelWarningPos = vec3(-5.,0.,-8.);
eyeDir = vec3(.5,-0.15,1.);
animationAmp = vec3(0.,0.5, 1.); // Slow walk
animationSpeed = vec3(3.,1.5,6.);
float transition = smoothstep(0.,1.,time);
camFocal = mix(4., 3., transition);
camPos = vec3(0.,3., -4.);
camTa = mix(vec3(0., 3., 0.), vec3(-5., 5., -9.), transition);
} else if (time < 88.) { // Panel moonwalk
float time = time-81.25;
sheepPos = vec3(0.,0.,-11.);
panelWarningPos = vec3(-5.,0.,-8.);
eyeDir = normalize(mix(vec3(1.,-.5,1.), vec3(0.,.5,1.), smoothstep(2.8,3.2, time)));
eyeDir = mix(eyeDir, vec3(1.,-.5,1.), smoothstep(6.,6.5, time));
headRot.y = smoothstep(3.,3.5, time)*.6;
headRot.x = smoothstep(3.,3.5, time)*smoothstep(7.,5., time)*.25*sin(time*3.);
animationAmp = vec3(1.,.2,.5);
animationSpeed = vec3(0.,.2,1.);
camPos = vec3(-3.,4.8,-30.);
camTa = vec3(-3., 4., 0.);
camFocal = 3.5;
} else if (time < 96.) { // Panel moonwalk
float time = time-87.;
float up = smoothstep(6.,9.,time);
sheepPos = vec3(0.,0.,time*.25-11.);
panelWarningPos = vec3(-2.,0.,-8.);
eyeDir = vec3(-.5,.25-up,1.);
headRot.y = .5-up*1.;
animationAmp = vec3(1.,.2,.5);
animationSpeed = vec3(-1.,1.,1.)*.5;
camPos = vec3(18.,5.,-5.);
camTa = vec3(-5., 5., -6.);
camFocal = 3.;
} else if (time < 102.) { // look at sign then flower
float time = time-96.;
animationAmp = vec3(0.);
animationSpeed = vec3(0.);
panelWarningPos = vec3(0.,0.,-8.);
if (mod(time, 3.) < 1.5) {
blink=0.;
camPos = vec3(0.,2., -8.);
camTa = vec3(0., 3., 0.);
} else {
camPos = vec3(0.,5.5, 2.);
camTa = vec3(0., 5.75, 0.);
}
eyeDir = vec3(0.,-.1,1.);
camFocal = 3. + time*.1;
} else if (time < 110.) { // looking around
float time = time-103.5;
float t = sin(min(time,5.));
animationAmp = vec3(0.);
animationSpeed = vec3(0.);
eyeDir = normalize(vec3(t*.7,0.,1.));
eyeDir = mix(eyeDir, vec3(-0.3,.2,1.), smoothstep(5.2,5.4,time));
headRot.x = t * 0.25;
eyesSurprise = smoothstep(6.,6.2,time)*.2;
sheepPos = vec3(0.,(smoothstep(6.,6.2,time)-smoothstep(6.2,6.4,time))*.4,0.);
camFocal = 3.5;
camPos = vec3(0.,2., -8.);
camTa = vec3(0., 3., 0.);
} else if (time < 112.) { // sign -> flower
float time = time-110.;
sheepPos = vec3(INFINITE);
panelWarningPos = vec3(-2.,0.,-8.);
flowerPos = vec3(5.,0.,-20.);
float transition = smoothstep(.5,1.,time);
camFocal = mix(3., 4., transition);
camPos = vec3(0.,5.5, 2.);
camTa = mix(vec3(-.5, 5.75, 0.), vec3(5., 2., -20.), transition);
excited.x = transition*.3;
} else if (time < 117.8) { // focus face / warning / flower
float time = time-112.;
time *= 1.2; // we should get rid of this
float t = sin(clamp(time,0.,6.28));
animationAmp = vec3(0.1);
animationSpeed = vec3(0.2);
camFocal = 2.8 + time*.15;
int iTime = int(time);
if (iTime % 4 == 1) { // sign
panelWarningPos = vec3(0.,0.,-8.);
camPos = vec3(2.5,2., -1.);
camTa = vec3(1., 5.25, -8.);
camFocal = 2.8 + pow(time*.3,1.2);
} else if (iTime % 4 == 3) { // flower
flowerPos = vec3(4.,0.,-8.);
camPos = vec3(0.,5.5, 2.);
camTa = vec3(4., 3., -8.);
excited.x = .3 + .2/12.;
excited.y = time/12.;
} else { // sheep
camPos = vec3(0.,2.4, -8.);
camTa = vec3(0., 3., 0.);
}
float p = smoothstep(.3,.7,fract(time));
if (iTime % 4 == 0) p = 1. - p;
headRot.x = -p*.1;
eyeDir = normalize(mix(vec3(0.1,-.25,1.), vec3(-.2,.2,1.), p));
eyeDir = eyeDir + vec3(cos(time*10.),cos(time*5.),1.)*.01;
} else if (time < 121.8) { // flower alone
float time = time-118.;
sheepPos = vec3(INFINITE);
panelWarningPos = vec3(-2.,0.,-8.);
flowerPos = vec3(5.,0.,-20.);
camFocal = 9.+time*.2;
camPos = vec3(0.,5.5, 2.);
camTa = vec3(5., 2., -20.);
excited.x = .4;
excited.y = time;
} else if (time < 125.) { // decision taken
float time = time-120.;
float t = sin(clamp(time,0.,6.28));
animationAmp = vec3(0.0,.1,0.);
animationSpeed = vec3(0.,.5,0.);
camPos = vec3(0.,2.4, -8.);
camTa = vec3(0., 3., 0.);
headRot.x = -.1;
headRot.y = sin(time*2.)*.1;
eyesSurprise = smoothstep(0.,3.,time)*.1;
eyeDir = vec3(-.2,.2,1.);
camFocal = 3.2 - time*.15;
excited.x = .1;
excited.y = 5.;
} else if (time < 137.) { // Flower run
float time = time-125.;
eyeDir = vec3(0.,0.,1.);
sheepPos = vec3(0.,0.,-time*2.+2.);
flowerPos = vec3(.0,-0.5,-30.);
animationAmp = vec3(1.,1.,.5);
animationSpeed = vec3(3.,1.5,8.);
float t = smoothstep(0., 10., time);
camPos = vec3(-2., 3.5,mix(-10.,-33., t));
camTa = vec3(2., 2, -3.-time*2.);
camFocal = 3.;
} else if (time < 142.) { // Splash
float time = time-137.2;
eyeDir = vec3(0.,0.,1.);
sheepPos = vec3(0.,(1.-smoothstep(.3,.25,time))*-4.8,-22.-time*2.);
flowerPos = vec3(2.,0.,-30.);
animationAmp = vec3(1.,1.,.5);
animationSpeed = vec3(3.,1.5,8.);
camPos = vec3(-20.,6.,-13.) + vec3(cos(time*72.),cos(time*64.),sin(time*48.))*3.* smoothstep(0.3,0.31,time)* smoothstep(0.7,0.1,time);
camTa = vec3(3., 2., -23.);
camFocal = mix(4.,4.2, smoothstep(0.,5.,time));
anvilPos = vec3(0.,smoothstep(.3,.2,time)*13.,-22.);
} else { // ending screen
float time = time-143.;
eyeDir = vec3(0.,0.,1.);
sheepPos = vec3(INFINITE);
panelWarningPos = vec3(-1.,0.,-8.);
flowerPos = vec3(1.,0.,-25.);
camTa = vec3(2., 3.6, -18.);
camPos = vec3(5.,5.,2.);
float transition = smoothstep(1.7,2.2,time);
camFocal = 2.5 + transition*4.2;
anvilPos = vec3(7.,0.,-20.);
}
eyeDir=normalize(eyeDir);
}