-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy path509 Creating 3D Interactive Content With WebGL [English].srt
More file actions
4404 lines (3477 loc) · 83.8 KB
/
509 Creating 3D Interactive Content With WebGL [English].srt
File metadata and controls
4404 lines (3477 loc) · 83.8 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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1
00:00:11,071 --> 00:00:15,160
hi everyone I'm team in a few minutes my
colleague Brady will come up
2
00:00:16,006 --> 00:00:20,041
we both engineers on apples would
contain how often have you heard a
3
00:00:20,095 --> 00:00:21,139
presentation start with
4
00:00:22,039 --> 00:00:25,088
today I'm really excited to talk to you
about blah blah blah
5
00:00:25,439 --> 00:00:29,320
and I told myself I didn't really wanna
introduced this session that way and
6
00:00:29,032 --> 00:00:31,077
then I realized I actually am really
passionate about this topic
7
00:00:31,077 --> 00:00:34,084
because over the past two years have
worked on a lot of graphics technology
8
00:00:35,047 --> 00:00:36,526
on the web like a CG
9
00:00:36,949 --> 00:00:39,954
canvas CSS transforms animations
10
00:00:40,449 --> 00:00:44,478
filters and I really think like web-dl
is the next significant leap in the talk
11
00:00:44,739 --> 00:00:46,420
graphics you can do in webbrowser
12
00:00:46,042 --> 00:00:50,047
repeal takes the the power
13
00:00:50,092 --> 00:00:55,071
the open gles standard which is popular
on my ball chips
14
00:00:55,899 --> 00:00:58,958
and combines it with Nick speed and
convenience have JavaScript
15
00:00:59,489 --> 00:01:02,730
the web programming language this means
well
16
00:01:02,073 --> 00:01:05,149
because you got this proliferation
really powerful keep you hardware
17
00:01:06,049 --> 00:01:11,051
um combined with this incredible
performance improvement in JavaScript
18
00:01:11,069 --> 00:01:13,158
we've had this sort of sweet spot we can
do these amazing graphics
19
00:01:14,058 --> 00:01:19,127
this gonna give you before power for
configurable and programmable pipeline
20
00:01:20,027 --> 00:01:25,356
as well as performance but because you
talking directly to the GP you
21
00:01:25,599 --> 00:01:28,612
and because JavaScript is
22
00:01:28,729 --> 00:01:32,360
a super fast nowadays this get allow you
to write
23
00:01:32,036 --> 00:01:35,134
web content such is showing an
interactive 3d model
24
00:01:36,034 --> 00:01:39,099
while still maintaining their
flexibility and he's abusive having your
25
00:01:39,099 --> 00:01:41,458
text in the attractive controls in HTML
26
00:01:42,349 --> 00:01:45,470
maybe wanna take that 3d model little
bit further
27
00:01:45,047 --> 00:01:48,196
and do something like a an architectural
walk work a
28
00:01:48,619 --> 00:01:52,000
flow-through a a building site you can
see here we've got
29
00:01:52,000 --> 00:01:59,000
more advanced lighting shadows is also
data visualization
30
00:02:01,239 --> 00:02:05,130
and mapping unit 3d mapping is becoming
more popular
31
00:02:05,013 --> 00:02:09,028
but such as 3d let's say you want to do
a 2d
32
00:02:09,028 --> 00:02:12,065
you wouldn't provide something like an
image editor that's doing to day
33
00:02:12,065 --> 00:02:13,089
operations on your
34
00:02:13,089 --> 00:02:16,137
your content and he get to do something
the previously wasn't available
35
00:02:17,037 --> 00:02:24,037
always difficult to do in regular
JavaScript awesome is very popular on
36
00:02:24,095 --> 00:02:27,143
on the web is just doing image
transitions so you got something
37
00:02:28,043 --> 00:02:32,112
bit more be more exciting than a normal
image slide we can do a 3d ripple effect
38
00:02:33,012 --> 00:02:36,017
and of course those games this is a
39
00:02:36,062 --> 00:02:39,133
a demo angry bought by unity where you
got this console level
40
00:02:40,033 --> 00:02:44,081
game engine which has things like a
realistic lighting particles
41
00:02:44,081 --> 00:02:47,099
and shadows and also the ability to
destroy
42
00:02:47,099 --> 00:02:50,103
evil robot or maybe you want to do
something
43
00:02:51,039 --> 00:02:54,064
make you to do something like casual
gaming
44
00:02:54,064 --> 00:02:58,077
and this is a sweep by play campus and
it's a really great innovative take on
45
00:02:58,077 --> 00:02:58,114
that
46
00:02:59,014 --> 00:03:02,067
infinite to tear on a incentive like
sliding along in 2d
47
00:03:02,067 --> 00:03:05,102
you're actually flying this summer nice
stylized I
48
00:03:06,002 --> 00:03:13,002
plane around this radio Island it's
quite fun so what did you learn today
49
00:03:13,067 --> 00:03:16,216
I'm will stop by how to setup
50
00:03:16,819 --> 00:03:20,180
had to get access to a video and send it
up in your web page
51
00:03:20,018 --> 00:03:24,033
and they were gonna show had to do basic
drawing with you on this is going to be
52
00:03:24,033 --> 00:03:26,124
sort of like a crash course in how to
draw something with web DL
53
00:03:27,024 --> 00:03:30,122
and you get an idea of how powerful the
rendering system is
54
00:03:31,022 --> 00:03:34,027
went to get that were actually gonna
move on to advanced roaring
55
00:03:34,027 --> 00:03:37,100
and had to do simple animation and
nothing because its web technology
56
00:03:38,000 --> 00:03:41,459
we want to tell you how would your feet
into other part to the web platform
57
00:03:41,459 --> 00:03:45,730
important topic is whereas web-dl
available
58
00:03:45,073 --> 00:03:48,151
and we're happy to side with deal is
available in Safari on almost any
59
00:03:49,051 --> 00:03:49,103
seventy
60
00:03:50,003 --> 00:03:56,025
and I was announced on Monday and what
wasn't announced
61
00:03:56,025 --> 00:03:59,068
but I'm happy to say that also available
in Safari on eyewear
62
00:03:59,068 --> 00:04:04,957
I'm
63
00:04:05,569 --> 00:04:10,240
be even better news is this with deals
available on every device that can
64
00:04:10,024 --> 00:04:11,090
install these operating systems
65
00:04:11,009 --> 00:04:15,088
I'm if your program on you want to use
web video content in your app
66
00:04:16,069 --> 00:04:20,088
you gonna wanna know about the modern
web kid API and its wk we view
67
00:04:20,088 --> 00:04:24,097
class now one of the many benefits of
using this new modern API
68
00:04:24,097 --> 00:04:29,150
is that you get full benefit love the
the jumps with nitro engine which means
69
00:04:30,005 --> 00:04:30,046
you're
70
00:04:30,091 --> 00:04:33,094
your contents gonna be running super
fast which we all know is
71
00:04:34,021 --> 00:04:37,045
Craigs mom's favorite feature and she's
updated elapse
72
00:04:37,045 --> 00:04:40,119
do the modern API I'm something else is
73
00:04:41,019 --> 00:04:44,058
that the a the API service
74
00:04:44,058 --> 00:04:47,140
area between I O S in with 10 is
identical this means that your
75
00:04:48,004 --> 00:04:51,066
your content should run this time on
both devices with a course
76
00:04:52,002 --> 00:04:56,053
the understanding that some devices
don't run don't have as powerful GP use
77
00:04:56,053 --> 00:04:59,078
but otherwise it's identical and simply
because it's a web standard
78
00:04:59,078 --> 00:05:04,104
that same content should run on other
browsers that support web DL
79
00:05:05,004 --> 00:05:08,023
now creating great 3d content is
80
00:05:08,023 --> 00:05:11,038
made a lot easier if you have a good
tool system and
81
00:05:11,038 --> 00:05:14,044
even though a deals a relatively young
technology it does have a sort of
82
00:05:14,044 --> 00:05:15,047
thriving ecosystem
83
00:05:15,047 --> 00:05:18,143
tools the couple I wanna call out in
particular and he's a big vendors
84
00:05:19,043 --> 00:05:23,125
Epic Games the makers have Unreal Engine
and Unity Technologies makers have unity
85
00:05:24,025 --> 00:05:28,026
but both have announced web-dl export
from their systems
86
00:05:28,026 --> 00:05:31,028
um this means not only to get the
state-of-the-art 3d
87
00:05:31,046 --> 00:05:34,103
engines and editing environments US get
access to the marketplace where you can
88
00:05:35,003 --> 00:05:36,059
purchase 3d models
89
00:05:36,059 --> 00:05:41,065
or materials or other assets to help you
make your content
90
00:05:41,065 --> 00:05:44,072
another example is the company could
play campus who also have a 3d engine
91
00:05:45,035 --> 00:05:46,035
and editing tool
92
00:05:46,035 --> 00:05:48,126
but they do it all within the web
browser and this means that you can have
93
00:05:49,026 --> 00:05:50,055
distributed teams
94
00:05:50,055 --> 00:05:54,096
working inside a browser editing the
same content it's pretty cool
95
00:05:54,096 --> 00:05:57,100
if you're a developer there's a bunch of
open source liar is not just listed a
96
00:05:58,000 --> 00:05:59,012
few here
97
00:05:59,012 --> 00:06:03,014
much to these dues wrapped the lower
level with DAPI in something
98
00:06:03,032 --> 00:06:07,113
from the higher which allows you to
program in terms of fees in q2 materials
99
00:06:08,013 --> 00:06:11,016
rather than buffers and triangles
100
00:06:11,016 --> 00:06:13,087
but today we gotta talk about buses and
triangles because we think it's
101
00:06:13,087 --> 00:06:13,169
important
102
00:06:14,069 --> 00:06:17,132
that you understand that level love have
programming such as if you are using
103
00:06:18,032 --> 00:06:19,108
from these high-level tools
104
00:06:20,008 --> 00:06:23,009
you have some hints as to what might be
going wrong what you can do to improve
105
00:06:23,018 --> 00:06:25,029
the content
106
00:06:25,029 --> 00:06:28,047
before getting to that I just wanna talk
about one thing which is
107
00:06:28,047 --> 00:06:31,113
a motivation why we doing this so Apple
is always
108
00:06:32,013 --> 00:06:35,068
considered rich powerful graphics to be
super important to
109
00:06:35,068 --> 00:06:38,106
web developers into this fiery engine
effect this is why
110
00:06:39,006 --> 00:06:42,065
about a decade ago we invented the
campus element which is what the bases
111
00:06:42,065 --> 00:06:44,554
away geo is
112
00:06:45,139 --> 00:06:48,217
I'm as soon as where deal was announced
we joined the working group
113
00:06:48,919 --> 00:06:52,919
and to this day we volunteer ourselves
as the editor the specification
114
00:06:52,919 --> 00:06:55,922
the next question is why do we choose
Open GL
115
00:06:55,949 --> 00:07:00,810
and I'm jail is the most important
standard a graphics API that around
116
00:07:00,081 --> 00:07:03,940
I'm it's already been demonstrated it
can run on a billion mobile devices
117
00:07:04,669 --> 00:07:07,725
and the content you create there is
still just amazing on on other devices
118
00:07:08,229 --> 00:07:12,310
more powerful devices as well so again
it's sorta made
119
00:07:12,031 --> 00:07:15,034
a no brainer that we choose the best
standard and that way all browsers can
120
00:07:15,034 --> 00:07:19,056
implement we end up with web-dl
121
00:07:19,056 --> 00:07:22,154
okay so let's get coding I like all
122
00:07:23,054 --> 00:07:26,137
program examples we want to start with
hello world and
123
00:07:27,037 --> 00:07:31,896
went to the hello world GL so image in
your opening your text editor
124
00:07:32,229 --> 00:07:35,276
and with starting with a blank slate
which is good type a few commands and
125
00:07:35,699 --> 00:07:36,820
create something
126
00:07:36,082 --> 00:07:41,085
that this summer the 3d interactive
environment
127
00:07:41,085 --> 00:07:45,103
where actually start with something very
simple which is a triangle but
128
00:07:46,003 --> 00:07:49,040
well that might and disappointing if we
go back to the 3d environment
129
00:07:49,004 --> 00:07:52,803
we look at it and think actually let's
take a look at actually made up
130
00:07:53,199 --> 00:07:57,130
millions a little triangles makes those
triangles have hair color
131
00:07:57,013 --> 00:08:00,090
or texture applied to some lighting and
then we're entering it again with
132
00:08:00,009 --> 00:08:02,053
another part where we might be doing
blurs
133
00:08:03,034 --> 00:08:06,113
a close eye shadows or whatever when you
combine all together
134
00:08:07,013 --> 00:08:10,055
you actually do get the advanced
rendering so you
135
00:08:10,055 --> 00:08:13,112
you learn a lot of detail from how to
draw one triangle
136
00:08:14,012 --> 00:08:18,091
and the power that you learn goes on to
create better things
137
00:08:18,199 --> 00:08:24,199
so it start creating configuring and
roaring and for that we need four things
138
00:08:24,199 --> 00:08:28,240
first we gonna meet somewhere to draw to
something to drawn to
139
00:08:28,024 --> 00:08:31,099
them again in the coming to draw with me
to configure that
140
00:08:31,099 --> 00:08:34,938
being tuzla paint we wanted wanna paint
with and lastly we going to do the
141
00:08:35,829 --> 00:08:38,843
drawing will go through to the steps one
by one
142
00:08:38,969 --> 00:08:42,130
let's start with something to draw on to
and
143
00:08:42,013 --> 00:08:46,142
artists like myself call this a canvas
which is a super
144
00:08:46,259 --> 00:08:49,303
convenient because HTML already has an
element called can def
145
00:08:49,699 --> 00:08:53,732
so use that and this is like a regular
image element except
146
00:08:54,029 --> 00:08:58,077
instead of getting the the graphics to
draw from say a fall on the web
147
00:08:58,509 --> 00:09:02,551
you provide the command in javascript
that drawing to the image in the brown
148
00:09:02,929 --> 00:09:03,950
surrendered that
149
00:09:04,139 --> 00:09:07,144
you might already have one in your pages
the camps element we can create 13
150
00:09:07,639 --> 00:09:09,910
JavaScript by create a lament
151
00:09:09,091 --> 00:09:12,440
in my example under pretend I'm already
got one in the page I'm gonna selected
152
00:09:13,259 --> 00:09:14,170
using the
153
00:09:14,017 --> 00:09:18,026
Dom a PRI and restoring the local
variable campus cuz I wanna reference to
154
00:09:18,179 --> 00:09:19,223
it lighter
155
00:09:19,619 --> 00:09:22,720
now before I can draw into it I need to
tell the system
156
00:09:22,072 --> 00:09:25,161
how big an image it is or how many
pixels it needs to allocate
157
00:09:25,809 --> 00:09:30,480
so that when I draw the the rendering
happens into that into that image
158
00:09:30,048 --> 00:09:33,347
I do that by setting the width and
height variables on the campus
159
00:09:33,779 --> 00:09:37,670
here I want to set it to 600 by four
hundred but also want to take into
160
00:09:37,067 --> 00:09:37,986
account
161
00:09:38,589 --> 00:09:41,601
if I'm on a Retina Display I wanna high
resolution image from clearing
162
00:09:41,709 --> 00:09:44,750
window device pixel ratio
163
00:09:45,119 --> 00:09:47,197
that's all I need for me to draw the
next thing is I need something to draw
164
00:09:47,899 --> 00:09:47,965
with
165
00:09:48,559 --> 00:09:51,606
and in with GL that is the web your
rendering context this is the object
166
00:09:52,029 --> 00:09:55,097
that exposes the entire web geo API
167
00:09:55,709 --> 00:09:58,797
I'm income for me do that you get one
quite easily disco get context
168
00:09:59,589 --> 00:10:02,606
passing the cracked the screen printed a
web DL I'm
169
00:10:02,759 --> 00:10:05,792
if you're familiar with to decamp it's
raining would have seen someone call
170
00:10:06,089 --> 00:10:07,100
this with the 2d eight
171
00:10:07,199 --> 00:10:10,490
to the string and you get the two DAPI
so he we've
172
00:10:10,049 --> 00:10:13,518
we could with witty oh and we have a
very cool GL which is
173
00:10:13,959 --> 00:10:17,003
the thing we gonna draw with if you're
familiar with
174
00:10:17,399 --> 00:10:21,480
native open geo programming you might be
wondering where did I set my pixel
175
00:10:21,048 --> 00:10:21,767
format
176
00:10:22,199 --> 00:10:25,222
and create my rent a buffer zone from
about 6-8 ra you don't have to do that
177
00:10:25,429 --> 00:10:27,220
in web DL
178
00:10:27,022 --> 00:10:30,671
the previous step allocated the image to
get a drawing to and this step is giving
179
00:10:30,869 --> 00:10:34,922
you the context that you get a draw with
that all you have to do
180
00:10:35,399 --> 00:10:38,460
next we're gonna need something to we
need to configure the system
181
00:10:39,009 --> 00:10:42,160
and this is where it gets a little bit
tricky so if with very few lines with
182
00:10:42,016 --> 00:10:47,035
we've got time to draw with now we're
getting into the made in the system
183
00:10:47,035 --> 00:10:49,098
we're going to give this is where we
will start the crash course in in with
184
00:10:49,098 --> 00:10:50,647
your rendering
185
00:10:51,529 --> 00:10:54,576
before we able to render something we
need to do a few things we need to
186
00:10:54,999 --> 00:10:58,076
create buffer and buffers are just a set
of data that we gotta upload to the Jeep
187
00:10:58,769 --> 00:10:58,851
you
188
00:10:59,589 --> 00:11:01,657
and that data can be any types of things
but they're almost certainly go to
189
00:11:02,269 --> 00:11:05,286
contain the geometry that we won a
random
190
00:11:05,439 --> 00:11:08,508
next thing we need is a program which is
going to be the actual way that we have
191
00:11:09,129 --> 00:11:10,191
your renders it
192
00:11:10,749 --> 00:11:13,777
now you baby milk be confused here
because I we're already making a program
193
00:11:14,029 --> 00:11:14,410
what's
194
00:11:14,041 --> 00:11:17,122
is another program and the answer is it
is we could get into the details of what
195
00:11:18,022 --> 00:11:18,921
it is later
196
00:11:19,119 --> 00:11:21,970
but just imagine that you gonna be
running from specialized code to get
197
00:11:21,097 --> 00:11:23,826
uploaded also to the Jeep you an
executed their
198
00:11:24,699 --> 00:11:28,731
let's start with the buffers I wanna
draw this triangle
199
00:11:29,019 --> 00:11:32,023
and the triangle just made up of three
points
200
00:11:32,059 --> 00:11:35,860
in with GL the coordinate system goes
from -1 -1 on the bottom left
201
00:11:35,086 --> 00:11:40,235
to 11 in the top right and I wanna
create a buffer out of the 3-point
202
00:11:41,009 --> 00:11:45,027
so I'm going to do is allocate six
values arrive six values
203
00:11:45,189 --> 00:11:50,191
am at those points to those six values
so you're good x1 y1 x2 y2
204
00:11:50,209 --> 00:11:53,216
x3 y3
205
00:11:53,279 --> 00:11:57,338
and this is all I need to apply to the
Jeep use on a show you had to do that in
206
00:11:57,869 --> 00:11:57,935
with GL
207
00:11:58,529 --> 00:12:01,920
in javascript we'll start with the rave
six values
208
00:12:01,092 --> 00:12:06,761
this is JavaScript awry and I'm gonna
sign it into a flight 32 Ryan this is a
209
00:12:07,589 --> 00:12:08,683
special type to rain JavaScript
210
00:12:09,529 --> 00:12:12,530
telling the system that I want it to
imagine